opening standard stream in google-chrome opening standard stream in google-chrome linux linux

opening standard stream in google-chrome


Just use data URIs:

# google-chromeecho '<h1>hello</h1>' | google-chrome "data:text/html;base64,$(base64 -w 0)"# firefox (it will not automatic open since version 89, you must go to url and press enter)echo '<h1>hello</h1>' | firefox "data:text/html;base64,$(base64 -w 0)"# chromiumecho '<h1>hello</h1>' | chromium "data:text/html;base64,$(base64 -w 0)"# operaecho '<h1>hello</h1>' | opera "data:text/html;base64,$(base64 -w 0)"# Default browser (in debian systems)echo '<h1>hello</h1>' | x-www-browser "data:text/html;base64,$(base64 -w 0)"

The command base64 is available from coreutils on debian like systems

sudo apt-get install coreutils

If you not have coreutils installed or you cannot install new packages, you could use the python module base64 (virtually any distro has python)

echo '<h1>hello</h1>' | google-chrome "data:text/html;base64,$(python -mbase64)"


No, I don't think so. But you can do it via a temporary file instead:

TEMPFILE=`tempfile` && foo2html foo > $TEMPFILE && google-chrome $TEMPFILE