简体   繁体   中英

Jquery browser version detection

OS: Windows XP

Browser: Firefox 5.0 (use it and update it from 3.5)

Jquery: 1.6.2(from cdn http://code.jquery.com/jquery.min.js )

In my jquery script I use browser detection feature and it returns me 1.9.2.15 version, but here: http://en.wikipedia.org/wiki/Mozilla_Firefox_5#Version_5.0 there is no such version. Also I have problem because my script thinks that it work with Firefox 3.6 instead of 5.0.

Is this firefox's user agent bug or jquery?

Thanks.

UPD: it seems this is firefox bug, checked with http://developer.yahoo.com/yui/examples/yahoo/yahoo_ua_detection_clean.html and it created object YAHOO.env.ua with value gecko:1.92 !!!

UPD2: Checked my browser with http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/ it detected You are using version: 3.6.15 (3.6)

UPD3: Tested on Windows 7 with clean firefox - UA version = 5.0

UPD4: Posted to bugzilla https://bugzilla.mozilla.org/show_bug.cgi?id=669267

UPD5: Sorry everyone, found in "about:config" string replacement. It was old plugin bug.Thank to firefox developers for answer. Question closed. I will not remove this question so everyone will know to check "about:config" before panic:)

You will have to use jQuery plugin to see the "real" browser version:
http://jquery.thewikies.com/browser/

Live test case: http://jsfiddle.net/Zf3NW/1/
(Note it's included there under Manage Resources)

Tested under Chrome and Firefox and returned the true versions.

The version you're getting -- 1.9.2.15 -- is the version of the Gekko rendering engine, not of Firefox itself.

Each version of Firefox is shipped with a specific version of Gekko, so you can work out the Firefox version from this, provided you know that the user is running Firefox.

The thing is, though, that many of the smaller browsers on the market (eg Camino, Flock, IceWeasel, etc) borrow their rendering engines from the big name browsers. as is also used by other browsers, including Gekko, so a given version of Gekko could be running in Firefox, but it could also be running in another browser.

JQuery can't tell that, but it also doesn't really care -- as long as it knows which rendering engine it it, and what version, that deals with everything that JQuery needs to worry about, because browsers using the same rendering engine will generally render pages pretty much the same.

Hope that explains it a bit for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM