开发者

To open a web page in firefox by clicking an anchor tag

Once the user clicks an anchor tag I need to open a page in Firefox.

Example:

<!-- Currently the anchor tag is displaying in any of following browsers: 
     Internet Explorer, Opera, Safari, and Chrome -->
<a href="sample.html">Sample link to open in Fi开发者_开发技巧refox</a>

Once the user clicks the link, I need to open file sample.html in Firefox. Impossible is nothing. But I don’t know how to do this.

Is there is an option to do this in JavaScript, jQuery, or PHP?


You cannot, from a given web-page, specify in which software a link should be opened.

At best, if your anchor points to a specific kind of file (like a .doc), the system will know that it must use some other software than the browser (like MS Word -- or ask the user which software he wants to use). But, for an HTML page, the browser will be used.

And your website has no control over this.


If you mean exclusively in Firefox, it can't be done.

The best you can do is hide it from other browsers by sniffing the user agent if the browser is not Firefox. But a different browser can easily present itself as Firefox (by spoofing the user agent).

Either way, it is not a good idea.


Where is this anchor being displayed? In general, the link will be opened with the same program that is displaying the anchor. If not, it will launch whatever program is registered in the user's system to handle HTML files. You cannot force the user's system to use any specific browser (what happens if that browser isn't installed)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜