How to allow ruby ​​to use the default browser to open a local file

In this question , I believe that use is system('start http://www.google.com')in order. If the file is located on a local drive, use system('start file:///c:/temp/a.html')does not work. How can I get Ruby default browser to open a local file?

+3
source share
1 answer

What do you get when you double-click the .html file in Windows Explorer? If this is not a browser, this is your problem. The keyword 'start' starts the path through the ShellExecute function, since http: // URLs know to open it in the browser, if it is a file, it depends on the file extension if your system has .html pointing to For example, in notepad (because in the past you installed it in a notebook), it will always open it in this program, unless you go and change it specifically.

, Windows Ruby, HKEY_CLASSES_ROOT\http\shell\open\command , , HTTP-, (% 1 URL).

+1

Source: https://habr.com/ru/post/1730496/


All Articles