cowboy/jquery-hashchange

IE8 x-ua compatible mess

vvo opened this issue · 4 comments

vvo commented

Hello, dunno if this is a jquery bug or jquery onhashchange bug, i'll explain :
when a user activates compatibility mode in IE8 (so manual modification), jQuery.browser.version do report "7.0".
but if the website force ie7 mode (with meta http-equiv="X-UA.. content="IE=EmulateIE7), jQuery will report "8.0"

As you can see, the code from jquery-hashchange will fail here if the website uses the meta way. Because it'll try to use native onhashchange event wich will not be available when emulating ie7.

I know jQuery doesn't want to make fancy things on jQuery.browser, that's why i'm adressing the bug to jquery-hashchange

There's an easy workaround, just test document.documentMode wich will report good versions in both cases : "7.0" when the browser is in compatibility mode (manual way) or forced by a meta. Also it will report 8.0 if in normal mode

What do you think ?

source : http://msdn.microsoft.com/en-us/library/cc288325%28VS.85%29.aspx

Can you set up a test page where an error occurs? I can't actually replicate the issue (even though everything I've read suggest it shouldn't work)!

vvo commented

Ok those urls should do it :

  1. enable compatibility mode then refresh : http://jsbin.com/anaro3 => IE version from jquery : 7
  2. remove jsbin.com from you compatibility mode websites (in tools > compatibility mode params) sorry my browser is in french atm so not sure about the labels
  3. restart browser and go here :
    http://jsbin.com/udise/4
    browser version from jquery : 8 (compatibility mode is forced with meta tag)

only document.documentMode will give you the appropriate version (you can test it in the js console of ie developper tools)

Be carreful because as soon as you activate compatibility mode by hand, it will always work as you expect ("7.0")

I've just released v1.1, can you try it and see if the problem is resolved?

vvo commented

Works perfectly thanks good work !