philwilson.org

Cross-platform browser launcher for Ruby?

24 September, 2008

In Python, you can do this:

import webbrowser
webbrowser.open_new(<a href="http://philwilson.org/blog">http://philwilson.org/blog</a>)

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.

See other posts tagged with general ruby python and all posts made in September 2008.

Comments

Nolan Eakins
25 September, 2008 at 19:28

Steal the code from Shoes, toss it up on GitHub, and blog about it. 🙂

Phil
25 September, 2008 at 22:13

Yes, that *is* my plan so far 🙂

Gareth Simpson
30 September, 2008 at 21:30

Here, I tested stack overflow with it.

Phil
30 September, 2008 at 22:09

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?