Results 1 to 6 of 6

Thread: Can firefox render from stdin?

  1. #1
    Join Date
    Apr 2006
    Location
    Tejas
    Beans
    445
    Distro
    Ubuntu 9.10 Karmic Koala

    Can firefox render from stdin?

    I have an idea for a script which would generate some html based on results of a grep command. I would like to be able to view these results directly in firefox, preferably without writing a file to disk first. Is there any way to pipe input to firefox like that?
    Quote Originally Posted by smcnally
    For me, it's all about the penguin...If the Linux mascot was a tiger or an elephant, I would have never even tried it.

  2. #2
    Join Date
    May 2005
    Beans
    Hidden!

    Re: Can firefox render from stdin?

    Quote Originally Posted by Peepsalot View Post
    I have an idea for a script which would generate some html based on results of a grep command. I would like to be able to view these results directly in firefox, preferably without writing a file to disk first. Is there any way to pipe input to firefox like that?
    Sorry, I could not find any flag to pass to fx to manage this. However, this will work
    Code:
    tmpfilename="/tmp/tmp.html";#should be absolute path
    htmlstring="<html><strong>Your html here..</strong></html>"
    
    echo $htmlstring >$tmpfilename;
    firefox "file://$tmpfilename";rm $tmpfilename #removes tempfile after use
    Last edited by dabear; July 11th, 2006 at 02:01 AM.

  3. #3
    Join Date
    Apr 2006
    Location
    Tejas
    Beans
    445
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Can firefox render from stdin?

    Ok. I didn't try that because I thought there would be a problem with firefox not finishing loading before the file was deleted.

    But it works so I guess that's not really a problem. Thanks.
    Quote Originally Posted by smcnally
    For me, it's all about the penguin...If the Linux mascot was a tiger or an elephant, I would have never even tried it.

  4. #4
    Join Date
    Dec 2005
    Location
    Columbia, MO, USA
    Beans
    Hidden!
    Distro
    Ubuntu 6.06

    Re: Can firefox render from stdin?

    Quote Originally Posted by Peepsalot View Post
    Ok. I didn't try that because I thought there would be a problem with firefox not finishing loading before the file was deleted.
    Wouldn't you have to start Firefox in the background to do that (firefox "file://$tmpfilename" &;rm $tmpfilename)? As it is, it waits 'til Firefox quits before deleting anything.

  5. #5
    Join Date
    Apr 2006
    Location
    Tejas
    Beans
    445
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Can firefox render from stdin?

    Quote Originally Posted by fluffington View Post
    Wouldn't you have to start Firefox in the background to do that (firefox "file://$tmpfilename" &;rm $tmpfilename)? As it is, it waits 'til Firefox quits before deleting anything.
    Yeah, but if firefox is already open, it will load new tab, and the sript will continue without waiting for Firefox to close.

    It still works...i was just not too sure about it before.
    Quote Originally Posted by smcnally
    For me, it's all about the penguin...If the Linux mascot was a tiger or an elephant, I would have never even tried it.

  6. #6
    Join Date
    Apr 2006
    Location
    Tejas
    Beans
    445
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Can firefox render from stdin?

    Check this out. I posted the same question on the mozillazine forums and got an answer pointing me to this:
    http://en.wikipedia.org/wiki/Data:_URI_scheme
    It's pretty cool.
    Quote Originally Posted by smcnally
    For me, it's all about the penguin...If the Linux mascot was a tiger or an elephant, I would have never even tried it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •