Opening a html content in browser

Two questions :

  1. I have a html source as a String. Is there a way to show it in the
    default browser without first writing it to a temp file and then opening
    the file ?

  2. Opening a html file is ‘system( “open #{path}”)’ in OSX, *nix, but
    ‘system(“start #{path}”)’ in Windows. Is there a system-independant way
    ?

_md

See the “Launchy” gem.

No, “open” doesn’t work in “*nix”. On my Linux “open” is a synonym to
“openvt”.

“Is there a way to show it in the default browser without first writing
it to a temp file”

You could start an HTTP server, but I don’t think it worth the bother.
You could install some gem that manages temporary files.

Albert S. wrote in post #1049636:

See the “Launchy” gem

I’ll look. Thx !

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs