Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
547 views
in Technique[技术] by (71.8m points)

html - 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 Firefoxfirefox.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 Firefoxfirefox.exe google.com">Click me!</a>

What am I missing?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...