问题
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:
Apparently jQuery reports the version of the Gecko rendering engine
回答2:
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?
回答3:
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 .
回答4:
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.
来源:https://stackoverflow.com/questions/1398962/why-does-jquery-browser-version-return-1-9-1-2-for-firefox-3-5-2