6
$\begingroup$

For the purposes of lecturing I use the statement as the one below:

    Button["Show MD simulation of a liquid", 
 SystemOpen["https://www.youtube.com/watch?v=MqDAs2nWnE0"]]

to enable myself to open during the lecture a YouTube movie that I need. Since I then distribute the notebook with the lecture among the students they are assumed to be able to do the same.

I faced, however, the problem, that on one of my computers the site tries to open in the Internet Explorer (which I normally do not use), and, finally does not work for whatever reason. In contrast, it does not open in the Mozilla which I use, and where the movie perfectly plays.

The question is: can I specify what browser to use when executing the SystemOpen statement?

$\endgroup$
  • 1
    $\begingroup$ Since you are distributing the notebook it would be better to set the default browser on your computer as the Mozilla browser. You do not know which browser the students will have installed on their machine so it setting a particular program could cause it to fail for them. $\endgroup$ – Edmund Feb 27 '17 at 8:40
  • $\begingroup$ @Edmund Thank you, that's right, I did not notice that it is not a standard one. $\endgroup$ – Alexei Boulbitch Feb 27 '17 at 8:45
  • $\begingroup$ related: How to open hyperlinks (from web-embedded CDF) in a new tab $\endgroup$ – Kuba Feb 27 '17 at 8:55
6
$\begingroup$

SystemOpen passes its argument to the operating system. Mathematica does not control which browser will be used, the operating system does.

Operating systems usually maintain a list of associated programs for every URI scheme. There will be a default program for http:// and https://, one for ftp://, another one for ssh://, for skype://, etc. How to change these associations depends on your particular OS (and its version). The association for http is usually controlled by the "Default Browser" setting.


You can in principle run a specific browser directly with Run, and pass the link to it as an argument. But you would need to know the location of its executable. Different computers may have different locations, and will usually have different browsers installed.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.