Reliable browser detection using javascript?

I have a website and a shutdown, like most sites that it loads faster in Firefox.

I want to create some form of panel that appears on top of my site whenever a user without FF logs into the site. This bar will say something like "Install FF for better performance, etc. Etc."

How should I do it? Browser detection, I think, but there are many different codes. Any code that you all know is more reliable and better to use?

Btw, does anyone know if I need permission from Mozilla to have such a panel on my site?

thank

EDIT: FF NOT A FAST BROWSER, I GOT THIS!

+5
source share
9 answers

(Skipping all the arguments about what you want to do is good or bad. Suppose you really love Firefox and want to promote it.)

  • Use the object navigatorto check if the browser is Firefox. navigator.appCodeName, navigator.appName, navigator.appVersion. What you want to do is not an important part of your website, so you do not need a fault tolerance detection method. If it works on more than 95% of your target users, than this method is good.

  • I doubt that you need to allow advertising for a free product. Mozilla even recommends you do this.

+10
source

, spreadfirefox.com: http://www.spreadfirefox.com/affiliates/utw. Spread Firefox, , . , , :


(: mozilla.org)


(: mozilla.org)


(: mozilla.org)


(: mozilla.org)

Javascript, , :

/* *********************************************
This code came from http://www.quirksmode.org/js/detect.html 
In order for this to function properly, it must be updated regularly
***********************************************/

, , ? , ?

+8

jQuery .

jQuery , , . , . .

+6

100%. userAgent, -, , . , , , , , .

+4

, HTML- :

http://www.quirksmode.org/css/condcom.html

IE.

Mozilla Foundation, , Chrome, Safari . , IE, . Internet Explorer.

, , .

/ ;)

+4

, . , , , , , .

, , , .

+2

, -1, Firefox , ? :

<!--[if IE]>
Special instructions for IE
<![endif]-->

jQuery

if ($.browser.msie)
+2

, . , Chrome Safari? Chrome , Firefox ( Sunspider), " Firefox" . ? IE, IE - . .

+1
+1

All Articles