Cross-platform browser launcher for Ruby?
24 September, 2008In 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.
Comments
Nolan Eakins
25 September, 2008 at 19:28
Phil
25 September, 2008 at 22:13
Gareth Simpson
30 September, 2008 at 21:30
Phil
30 September, 2008 at 22:09
Steal the code from Shoes, toss it up on GitHub, and blog about it. 🙂
Yes, that *is* my plan so far 🙂
Here, I tested stack overflow with it.
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?