Thomas Thomas - 10 days ago 6
HTML Question

How to open a specific URL in a specific browser from a link?

Even though IE is our default browser we want users to open links from email notifications in Firefox.

So I tried:

<a href="file:///C:\Program Files (x86)\Mozilla Firefox\firefox.exe">Click me!</a>


which works just fine, but when I try to pass the URL onto it it doesn't:

<a href="file:///C:\Program Files (x86)\Mozilla Firefox\firefox.exe google.com">Click me!</a>


What am I missing?

Answer

From a URL, you can't target a specific browser. That's a client preference and not something that you can specify in a URI.

BTW, the file:// scheme is simply to allow you to open local resources in browsers, and cannot execute applications. Picture clicking on:

<a href="file:///C:/Windows/System32/command.com+%2Fc+&quot;format+C:+/Q&quot;">Click me, I'm cool!</a>

If you want that kind of control, you'd have to implement (and roll out) your own schema mechanism. i.e. making firefox://http/somesite.com/foo/bar.htm bind to using Firefox specifically.