Cross-platform browser launcher for Ruby?

In Python, you can do this:

import webbrowser
webbrowser.open_new(http://philwilson.org/blog)

and lo! it will open your default browser at that URL whether you are on Windows, Linux or Mac.

I can’t find the same functionality in Ruby anywhere. I notice that even Shoes has its own native C implementation (check out the shoes_browser_open method in each of the platform-specific files in http://github.com/why/shoes/tree/master/shoes/native).

Does this really mean I’ll have to implement my own? Or have I simply missed the bundled one? Google really has not been my friend on this.

Published by

4 thoughts on “Cross-platform browser launcher for Ruby?”

  1. Wow, impressive. I really wasn’t sure if StackOVerflow was worth it, that appears to answer my questions.

    For what it’s worth, I’d already implemented the second solution for Windows-only.

    Did you actually try it on your mac?

Leave a Reply

Your email address will not be published. Required fields are marked *