best cricut

jQuery IE detection issue workaround

We recently discovered an issue with jQuery.browser.version detection, it reports wrong Internet Explorer versions on some corrupted IE userAgent strings. A corrupted IE8 userAgent string may look like,

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; GTB6; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET CLR 1.1.4322; InfoPath.2)

In this case jQuery.browser.version will report browser version 6.0 instead of 8.0, this will result some jQuery plugins to show a 'not implemented' error in IE8. So far we know jqModal and FancyBox are affected. Because they rely on jQuery.browser.version to detect IE6, and run some IE6 specific codes, which caused IE8 to fail, another sad story from MS.

Although we believe it's not the problem with jQuery or IE (Microsoft) alone, the best fix will be patching the plugins to detect IE6. i.e. to detect IE6 properly with jQuery, you will need the following code, which has an extra check by using window.XMLHttpRequest.

ie6=$.browser.msie&&($.browser.version == "6.0")&&!window.XMLHttpRequest;

If you curious about how userAgnet string got corrupted, we don't have much clue about it, some say it's due to an earlier release of IE8 (however as we aware, some IE7 has got the same issue), but in our office 3 out of 10 PCs has got the corrupted string. To fix it, you need to look for the following registry keys,

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform

Or if you want to do more then just differentiate IEs, you may find a good browser detection Javascript here.

Some side note, you might notice jQuery has marked jQuery.browser deprecated since 1.3 in the favour of We understand why jQuery would want to take this approach, and it's a good step forward. However would only be good if it tells all the feature differences among browsers, rendering engines, and standard modes. As web develops we don't learn the differences first then start developing a site, we only come across the differences and try to figure out what feature difference cause the different final result will be really time consuming. Until the time all the browsers come to the same standard and feature set, patching and hacking may be the only way for web developers, no one-stop solution would be available at any moment before that epoch. May God blessing all the web developers please.

Be Sociable, Share!


  • Thank you so much!! Very well explained. Fixed our problem too!

  • kost says:

    Thank you!

    Fixed my problems with wrong IE8/IE6 detection.

  • Garry says:

    Great post and thank you for doing it. Has saved me a massive headache!

  • thorn says:

    Thank you for sharing this.
    Was this issue submitted to the jQuery bug tracker?

  • Greg says:

    I’m having this issue using jq.modal. Where would I put this code?

    ie6=$.browser.msie&&($.browser.version == “6.0”)&&!window.XMLHttpRequest;

  • Jose Manuel says:

    My solution:

    The code for jqmodal:

    var BrowserDetect = {
    init: function () {
    this.browser = this.searchString(this.dataBrowser) || “An unknown browser”;
    this.version = this.searchVersion(navigator.userAgent)
    || this.searchVersion(navigator.appVersion)
    || “an unknown version”;
    this.OS = this.searchString(this.dataOS) || “an unknown OS”;
    searchString: function (data) {
    for (var i=0;i<data.length;i++) {
    var dataString = data[i].string;
    var dataProp = data[i].prop;
    this.versionSearchString = data[i].versionSearch || data[i].identity;
    if (dataString) {
    if (dataString.indexOf(data[i].subString) != -1)
    return data[i].identity;
    else if (dataProp)
    return data[i].identity;
    searchVersion: function (dataString) {
    var index = dataString.indexOf(this.versionSearchString);
    if (index == -1) return;
    return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
    dataBrowser: [
    string: navigator.userAgent,
    subString: "Chrome",
    identity: "Chrome"
    { string: navigator.userAgent,
    subString: "OmniWeb",
    versionSearch: "OmniWeb/",
    identity: "OmniWeb"
    string: navigator.vendor,
    subString: "Apple",
    identity: "Safari",
    versionSearch: "Version"
    prop: window.opera,
    identity: "Opera"
    string: navigator.vendor,
    subString: "iCab",
    identity: "iCab"
    string: navigator.vendor,
    subString: "KDE",
    identity: "Konqueror"
    string: navigator.userAgent,
    subString: "Firefox",
    identity: "Firefox"
    string: navigator.vendor,
    subString: "Camino",
    identity: "Camino"
    { // for newer Netscapes (6+)
    string: navigator.userAgent,
    subString: "Netscape",
    identity: "Netscape"
    string: navigator.userAgent,
    subString: "MSIE",
    identity: "Explorer",
    versionSearch: "MSIE"
    string: navigator.userAgent,
    subString: "Gecko",
    identity: "Mozilla",
    versionSearch: "rv"
    { // for older Netscapes (4-)
    string: navigator.userAgent,
    subString: "Mozilla",
    identity: "Netscape",
    versionSearch: "Mozilla"
    dataOS : [
    string: navigator.platform,
    subString: "Win",
    identity: "Windows"
    string: navigator.platform,
    subString: "Mac",
    identity: "Mac"
    string: navigator.userAgent,
    subString: "iPhone",
    identity: "iPhone/iPod"
    string: navigator.platform,
    subString: "Linux",
    identity: "Linux"


    * jqModal – Minimalist Modaling with jQuery
    * (
    * Copyright (c) 2007,2008 Brice Burgess
    * Dual licensed under the MIT and GPL licenses:
    * $Version: 03/01/2009 +r14
    (function($) {
    var p={
    overlay: 50,
    overlayClass: ‘jqmOverlay’,
    closeClass: ‘jqmClose’,
    trigger: ‘.jqModal’,
    ajax: F,
    ajaxText: ”,
    target: F,
    modal: F,
    toTop: F,
    onShow: F,
    onHide: F,
    onLoad: F
    return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;

    $.fn.jqmAddClose=function(e){return hs(this,e,’jqmHide’);};
    $.fn.jqmAddTrigger=function(e){return hs(this,e,’jqmShow’);};
    $.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$,t);});};
    $.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};

    $.jqm = {
    open:function(s,t){var h=H[s],c=h.c,cc=’.’+c.closeClass,z=(parseInt(h.w.css(‘z-index’))),z=(z>0)?z:3000,o=$(”).css({height:’100%’,width:’100%’,position:’fixed’,left:0,top:0,’z-index’:z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css(‘z-index’,z);
    if(c.modal) {if(!A[0])L(‘bind’);A.push(s);}
    else if(c.overlay > 0)h.w.jqmAddClose(o);
    else o=F;

    if(ie6){$(‘html,body’).css({height:’100%’,width:’100%’});if(o){o=o.css({position:’absolute’})[0];for(var y in {Top:1,Left:1}),”(_=(document.documentElement.scroll”+y+” || document.body.scroll”+y+”))+’px'”);}}

    if(c.ajax) {var||h.w,u=c.ajax,r=(typeof r == ‘string’)?$(r,h.w):$(r),u=(u.substr(0,1) == ‘@’)?$(t).attr(u.substring(1)):u;
    else if(cc)h.w.jqmAddClose($(cc,h.w));

    (c.onShow)?c.onShow(h);e(h);return F;
    close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
    if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
    var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == “6.0”)&&(BrowserDetect.version!=8),F=false,
    e=function(h){if(ie6)if(h.o)h.o.html(”).prepend(i);else if(!$(‘iframe.jqm’,h.w)[0])h.w.prepend(i); f(h);},
    m=function(e){var h=H[A[A.length-1]],r=(!$(‘.jqmID’+h.s)[0]);if(r)f(h);return !r;},
    hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
    if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};

  • Oleg says:

    Simply and fats, thanks!

RSS feed for comments on this post.

Copyright Orite Group Pty Ltd | Powered by WordPress | Theme: Aeros 2.0