This project is archived and is in readonly mode.

#798 ✓resolved
Russ Hall

IE7/8 incorrectly identified as trident4

Reported by Russ Hall | December 1st, 2009 @ 11:08 AM | in 1.3.0 rc2 (closed)

If the option in IE7/8 of "Enable native XMLHTTP support" (Tools/Internet Options/Advanced/Security) is unchecked, MooTools feature detection identifies the browser as IE6 (trident4).

From the latest core (this will incorrectly identify IE7 trident4):

return (!window.ActiveXObject) ? false : ((window.XMLHttpRequest) ? ((document.querySelectorAll) ? 6 : 5) : 4);

This setting (disabled native XMLHTTP) is quite common in the wild and seems to occur when upgrading from IE6 to IE8 quite frequently. Regardless, this is still broken feature detection as this missing API cannot be used as a check for which rendering engine is in use.

Comments and changes to this ticket

  • raider5

    raider5 December 2nd, 2009 @ 03:35 PM

    Hi,

    Would something like this be more reliable for IE:

    function trident() {
        return (!window.ActiveXObject) ? false : parseInt(new Element('div',{'html': '<!--[if IE 6]>4<![endif]--><!--[if IE 7]>5<![endif]--><!--[if IE 8]>6<![endif]-->'}).get('html'));
    }
    alert(trident() + '\n' + Browser.Engine.version);
    

    Cheers,

    SJ

  • Scott Kyle

    Scott Kyle December 3rd, 2009 @ 06:46 AM

    • Assigned user set to “Scott Kyle”
    • State changed from “new” to “open”
    • Milestone changed from 2.0 to 1.3.0 rc2

    This is indeed a bug and another fault of us using object detection. Our next release will switch to using User Agent detection, so until then I'll leave this bug open.

    @raider5 That's a pretty cool technique that I've never seen used before. :-) In Browser.js, the Element constructor isn't available yet, but this could be done with vanilla document.createElement.

  • raider5

    raider5 December 3rd, 2009 @ 10:07 AM

    @Scott - Yeah "document.createElement" etc would be required in Browser.js, the example was just to illustrate the technique. We used it as is, to avoid messing with core. Also instead of "window.ActiveXObject" we just checked the return value "charCodeAt(0) != 60" to ensure IE e.g.

    function trident() {   
        var elIETest = document.createElement('div');
        elIETest.innerHTML = '<!--[if IE 6]>4<![endif]--><!--[if IE 7]>5<![endif]--><!--[if IE 8]>6<![endif]-->';
        return elIETest.innerHTML.charCodeAt(0) == 60 ? false : parseInt(elIETest.innerHTML);
    }
    alert(trident());
    

    Would something like these conditional comments not be more robust for IE than "User Agent detection"?

    Cheers,

    SJ

  • Fábio M. Costa

    Fábio M. Costa February 12th, 2010 @ 03:01 PM

    Why dont we change for UA on 1.3?

  • fakedarren

    fakedarren February 13th, 2010 @ 03:44 PM

    • State changed from “open” to “resolved”

    This has been resolved for 1.3.

  • fakedarren
  • fakedarren

    fakedarren February 13th, 2010 @ 03:48 PM

    Must add that the method you suggest is pretty nifty and we're discussing using it.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages