IS there any way in Ruby to open a local HTML file in the user's default web browser? I could do something like:
system("open /path/to/file.html")
But that would only work on Mac OS X. Are there any solutions that work on any platform?
You can use the launchy gem.
First, install the gem:
$ [sudo] gem install launchy
Then, in your ruby code:
require 'rubygems'
require 'launchy'
Launchy::Browser.run("/path/to/file.html")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With