Reputation: 191
I want to write a script to run in rails console so that whenever I hit a URL, instead of giving the result as response, I want something to be triggered so that the URL is opened in chrome browser.
Example:
def open_url_in_chrome_browser(url)
end
When the function is called, the URL should open in chrome.
Upvotes: 0
Views: 915
Reputation: 353
You can do it by using this command on ubuntu machine.
exec("google-chrome www.google.com")
you can also define a method like for your local machine like this
def open_url_in_chrome_browser(url)
exec("google-chrome www.google.com")
end
Upvotes: 1