TurnWheel/jReject

Browsers Incorrectly Detected

Closed this issue · 7 comments

Opera 10+ and Chrome 10 are not being correctly identified. I'm sure the problem is with jquery.browser. Ultimately jquery browser needs to get updated and reworked. For instance, Opera should use window.opera.version() rather than relying on a regex.

Good Catch.

$.browser.versionNumber does show up as "10" for Chome 10.x
However, $.browser.className shows up as "chrome1". Obviously this is a problem with the regex used for determining the major version.

I tested Opera 11, and noticed the following results:
$.browser.versionNumber = 9.8

$.browser.className = "opera9"

I have sent a notice to the creator of jQuery browser plugin. If I don't hear back I may attempt to fix the plugin myself.

Thanks for the report :)

Any update on whether the jQuery browser creator will be updating the plugin?

I never heard back... so I guess I will look into fixing this myself. Been busy with other projects, but I will try to get to this over the weekend.

I actually went and decided to do some quick fixes to the script. https://gist.github.com/810342

I made two major changes: 1) If the browser is opera, use window.opera.version rather than a regex for determining the version 2) if the version number is under 100 and over 9 that the major version is 2 digits and not only 1.

The layout engine name for Opera is out of date as well as it is now, but I don't need that particular functionality and I'd warrant that it is almost entirely worthless having the layout.version and layout.name. http://en.wikipedia.org/wiki/Presto_(layout_engine)

The if function currently being used could just add in additional test cases, but I'd wager almost all Opera users are on at least on 11 by now.

Nice work. Saves me some time in figuring out the Opera issue on my own.

I will incorporate these changes later tonight.

@Akkuma
in line 56 there is a missing ";" - with that it is working great, thanks!
the whole script works with jQuery 1.5.1, too.
Is there a possibility to warn the user when using firefox 3.0 or 3.5 but not when using 3.6?

@rotanid
Firefox users historically update their browser fairly fast, so it isn't a big concern for me. You should be able to access the exact version through $.browser.version, albeit the exact version isn't added as a class to html. It wouldn't be a valid class to have a "." in it, but an underscore or dash would be. However, it doesn't seem really worth the effort to have an exact version for the css class.

I only checked it in FF4, since that is what I have installed now.