开发者

How to add and run a javascript for only on firefox not on others?

How to add and run a javascript for only on firefox not on oth开发者_如何学编程ers?

I've to add a javascript on a page and it should only work on firefox. not on IE


Never use browser detection, use object detection (if your intent was using some objects/methods available only on some browsers.)


use navigator object

navigator.appName

Returns the official name of the browser.


Aside from using navigator.appName, you could use the browser detection script from Quirksmode, then use an if statement to check if it's Firefox. This will nicely prepare browser information in an object for you, so you can pick out individual information such as version number, etc.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜