views:

594

answers:

5

Does anybody know why JQuery.browser.version returns 1.9.1.2 for Firefox 3.5.2

What's the pattern? How to detect major versions?

navigator.userAgent
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2"

 navigator.appVersion
"5.0 (Macintosh; en-US)"
+1  A: 

Anything based on the userAgent is unreliable. userAgent strings can be forged to look like something else or even just filled with garbage.

Test for the presence of functionality, not browser makers or browser versions.

Jonathan Fingland
jquery can't now test for css gradients
myfreeweb
+10  A: 

Apparently jQuery reports the version of the Gecko rendering engine

Tobias
+3  A: 

Possibly not the answer you're looking for, but you may be better off not be checking for browser versions anyway - instead, check for supported features. Otherwise, you may be excluding browsers that do not support a certain feature now, but may well do so in the future.

Did you look at jQuery.support?

skrebbel
+2  A: 

1.9.1.2 is the version number of the Gecko layout engine used in Firefox 3.5.2. This information is likely more useful to you than the Firefox version number itself, as it will give you an idea of the browser's supported features .

Alex Barrett