Skip to main content

Bug Tracker

Side navigation

#3169 closed bug (duplicate)

Opened July 17, 2008 07:33PM UTC

Closed January 15, 2009 03:20AM UTC

Last modified March 14, 2012 08:54PM UTC

Browser Detection is incorrect

Reported by: chrisbarr Owned by: flesler
Priority: major Milestone: 1.3
Component: core Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:
Description

I was trying to make some IE7 specific code and I soon realized that IE7 is incorrectly reported as version 6.0 in JQuery. Open up IE7 and head to http://docs.jquery.com/Utilities/jQuery.browser and then head to another JS based test like http://www.quirksmode.org/js/detect.html and you will see that it's being reported differently.

On the same note, I'm also running Firefox 3 and It's being reported as version 1.9.0.1 by JQuery.

Attachments (1)
  • ie7-version[5791].diff (0.4 KB) - added by flesler July 23, 2008 04:01PM UTC.

    What do you think about this patch ?

Change History (12)

Changed July 22, 2008 01:41AM UTC by flesler comment:1

component: sitecore
need: ReviewTest Case
priority: majorminor

Can you add the userAgent of both browsers ?

Get into this link and copy paste it into here (the version too please).

Btw, check the link that says "modified version" and see if the version reported is fixed in this one.

Changed July 23, 2008 12:05PM UTC by jamiethompso comment:2

This shouldn't have a minor priority. browser.version returns 6.0 in many installations of IE7. This is because the user agent string contains both "compatible; MSIE 7.0;" and "compatible; MSIE 6.0;" and the result varies depending on which is presented first in the string.

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)

The current regexp "userAgent.match( /.+(?:rv|it|ra|ie)[\\/: ]([\\d.]+)/ )" is no longer adequate for differentiating between IE6 and IE7.

A simple test like typeof document.body.style.maxHeight !== "undefined" would help to differentiate between a browser that really is IE6 or just IE7 presenting itself oddly.

Obviously as I say, this is pretty easy to workaround if you know about it. But this is a massive trip up for those who don't and it wreaks havoc with plugins that try and use browser.version to apply hooks into CSS workarounds for IE6.

Changed July 23, 2008 03:53PM UTC by flesler comment:3

owner: → flesler
priority: minormajor
status: newassigned

Changed July 23, 2008 03:55PM UTC by jamiethompso comment:4

Update: It seems that in some cases, because of a bug IE7 actually returns a user agent string of:

Mozilla/4.0 (compatible; MSIE 6.0)

The reasons for this are explained on my blog but revolve arounf browser toolbars and spyware messing with registry entries relating to the user agent string

Microsoft bashing aside, it looks as though accurately determining the Internet Explorer version has to involve more than just doing a regexp on the user agent string. IE7 is just far too unreliable in this respect.

I guess the question is should jQuery.browser.version simply represent what the user agent string reports or should it try it's best to report the actual browser version (using object detection and such) ?

Changed July 23, 2008 03:58PM UTC by flesler comment:5

need: Test CasePatch

Ok yes, We could add a specific check for IE7, lemme pull out a patch.

Changed July 23, 2008 04:04PM UTC by flesler comment:6

Ok, that's wrong, it won't catch IE8...

Changed July 23, 2008 04:08PM UTC by jamiethompso comment:7

How about?

jQuery.browser.msie && parseInt(jQuery.browser.version) == 6 && this.XMLHttpRequest

Changed August 12, 2008 10:01PM UTC by emartin24 comment:8

What about something like:

// Fix copies of IE7 that report MSIE 6.0

jQuery.browser.version = jQuery.browser.msie && parseInt(jQuery.browser.version) == 6 && window["XMLHttpRequest"] ?

"7.0" :

jQuery.browser.version;

Changed August 12, 2008 10:02PM UTC by emartin24 comment:9

Sorry:

// Fix copies of IE7 that report MSIE 6.0
jQuery.browser.version = jQuery.browser.msie && parseInt(jQuery.browser.version) == 6 && window["XMLHttpRequest"] ? 
	"7.0" : 
	jQuery.browser.version;

Changed August 25, 2008 11:35AM UTC by pschelotto comment:10

And how about changing:

userAgent.match( /.+(?:rv|it|ra|ie)[\\/: ]([\\d.]+)/ )

by

userAgent.match( /.*?(?:rv|it|ra|ie)[\\/: ]([\\d.]+)/ )

(tested in ie6, ie7 and Firefox)

Changed January 14, 2009 04:30AM UTC by dmethvin comment:11

Duplicate of #2661

Changed January 15, 2009 03:20AM UTC by dmethvin comment:12

resolution: → duplicate
status: assignedclosed