1

Update: The main question is, is there anything that would cause IE10 to render a page in IE5 quirks mode specifically (as opposed to compatibility mode in general) despite having the proper doctype and x-ua-compatible meta tag in place? (To be clear, we don't want the page to render in IE5 quirks, we want it to render in full IE10 standards.)


Our page is rendering in IE5 quirks mode for one customer, causing rendering to fail. I can use dev tools to force IE into the same mode and replicate the same failure, but why would this happen to him (and only him) in the first place? Could it be something in his environment, and could I simulate it on my end? The customer is using IE10.

We're using:

<!DOCTYPE html>

and:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

We're going to add an HTTP response header also:

X-UA-Compatible: IE=edge,chrome=1

But we have no way of verifying this fix since it works fine in our own instances of IE10.

greim
  • 9,149
  • 6
  • 34
  • 35
  • Have you checked your site using something such as http://www.my-debugbar.com/wiki/IETester/HomePage – JerryHuang.me Jul 31 '13 at 17:54
  • 1
    We also faced one such issue and ther cause turn out to be a MS Security patch (KB2846071) that was installed on customer's machine but not on ours. – Guanxi Jul 31 '13 at 17:57
  • (On his PC) Open up IE. Press ``, then go to `Tools` > `Compatibility View Settings` (I have no idea where to find this in the "gear" menu). Make sure "Display all websites in Compatibility View" is ***not*** checked. Also, make sure your site isn't in the list of sites on that pop up. Chances are, it's a setting on his PC. – gen_Eric Jul 31 '13 at 18:03
  • @Guanxi: So the security patch broke the website or fixed it? – gen_Eric Jul 31 '13 at 18:05
  • @JHuangweb - I'm not sure debugbar would help, since I need to replicate his environment and/or browser config more precisely, not simulate browser versions, which I can do easily using built-in dev tools. – greim Jul 31 '13 at 18:05
  • @RocketHazmat - I wondered about the compatibility view settings too. On my own IE10 instance, if I add my site to that settings UI, it changes how the site renders. However it doesn't change it in the same way; namely it doesn't force the site into IE5 quirks mode. – greim Jul 31 '13 at 18:11
  • Are you sure the customer is in "quirks mode"? Does he any toolbars installed? I know the AVG toolbar was breaking our website. – gen_Eric Jul 31 '13 at 18:15
  • @RocketHazmat - He sent us a screenshot with his IE dev tools open, where we could explicitly see "Document mode: IE5 Quirks" :) – greim Jul 31 '13 at 18:30
  • 1
    @greim: You sure he didn't change it just to troll you? :-P I'm kidding... anyway, other than some stupid toolbar, I can't think of why it'd work on your machine and not his. – gen_Eric Jul 31 '13 at 18:31
  • 1
    Was the markup that came to the customer exactly the same as you served? Couldn't it be that some proxy ets. adds something (e.g. HTML comment) `before Doctype?` – Ilya Streltsyn Jul 31 '13 at 18:35
  • See this answer : http://stackoverflow.com/questions/11865188/does-the-windows-8-internet-explorer-10-still-have-quirksmode#11865561 – Milche Patern Jul 31 '13 at 18:41
  • 1
    @MilchePatern: If you add `http://` to the URL it should become clickable. – gen_Eric Jul 31 '13 at 18:44
  • 1
    @RocketHazmat, trolling had in fact occurred to me, as well as proxy interference. Also he might have unintentionally triggered the setting in his dev tools, or left it in that mode from a previous debugging session and forgot. In any case I'm gathering this is a fairly wonky corner case. We're going to push the http header fix for now and cross our fingers. – greim Jul 31 '13 at 18:44

1 Answers1

1

From this link : http://blogs.msdn.com/b/deviations/archive/2009/05/07/how-to-enable-ie-8-compatibility-view-for-your-whole-web-site-or-for-specific-web-site-directories.aspx

The question many customers asked is ”How can I force the client browser to use the Compatibility View when they visit our site? So that the customer doesn’t have to activate it on the client side.”

Web Developers and Site Administrators can configure IIS and their sites to tell Internet Explorer 8 to automatically Emulate Internet Explorer 7 when they visit their site or just specific WebPages.

This is done by adding a custom HTTP Header to the IIS and the website web.config or to add a meta tag to specific pages. The HTTP Header is interpreted by the Internet Explorer 8 which will activate the compatibility view. All other browsers will simply ignore this custom HTTP Header.

X-UA-Compatible: IE=EmulateIE7

This is to FORCE rendering in compatibility mode.

If you want to 'simulate' a browser in compatibility mode, user RocketHazmat mentioned what to do (with tools > settings) in a comment.

You can get familiar with this property and the Compatibility View mode of IE8 and IE9 via the following two blogs: Introducing Compatibility View: http://blogs.msdn.com/b/ie/archive/2008/08/27/introducing-compatibility-view.aspx. Introducing IE9's User Agent String: http://blogs.msdn.com/b/ie/archive/2010/03/23/introducing-ie9-s-user-agent-string.aspx.

If you want to 'detect' IE compatibility view mode:

i found this SO answer interesting : JavaScript: Can I detect IE9 if it's in IE7 or IE8 compatibility mode? (document.documentMode is the best way). The subject on stackoverflow from a google search.

from this link : http://social.msdn.microsoft.com/Forums/vstudio/en-US/ae715fd2-1ddd-46f7-8c26-9aed6b2103f1/how-to-detect-compatibility-mode-in-ie-any-version

After research, we can find that the values to the User Agent String under different browse modes are:

  • IE7: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1;...)
  • IE8: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0;...)
  • IE8 Compatibility View: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0;...)
  • IE9: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
  • IE9 Compatibility View: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0;...)

Note that some irrelevant values in the strings are ignored, we only need to focus on some critical values which can be combined to decide the browse mode, like MSIE version NO. and Trident Mode NO..

Here comes the final solution:

    var agentStr = navigator.userAgent;
     var mode;
     if (agentStr.indexOf("Trident/5.0") > -1) {
         if (agentStr.indexOf("MSIE 7.0") > -1)
             mode = "IE9 Compatibility View";
         else
             mode = "IE9";
     }
     else if (agentStr.indexOf("Trident/4.0") > -1) {
         if (agentStr.indexOf("MSIE 7.0") > -1)
             mode = "IE8 Compatibility View";
         else
             mode = "IE8";
     }
     else
         mode = "IE7";

     document.title = "Browser Mode:\t" + mode;
     //document.write(navigator.userAgent);

Something else : stackoverflow.com/questions/11865188/does-the-windows-8-internet-explorer-10-still-have-quirksmode#11865561 where they explain the 2 IE10 quirks mode. Relevant to your situation. Hope it helps.

Community
  • 1
  • 1
Milche Patern
  • 19,632
  • 6
  • 35
  • 52
  • I'm pretty sure he wants the site to *NOT* run in Compatibility View. Plus, in the question, he shows that he knows how to use the `X-UA-Compatible` header. – gen_Eric Jul 31 '13 at 18:07
  • 1
    Compatibility mode is not the same as EmulateIE7. – nullability Jul 31 '13 at 18:18
  • AFAIK, Compatibility mode is *almost* the same as EmulateIE7 except of some details in the `User-agent` string. But both of them should have nothing to do with *Quirks* mode given the page has ` `. – Ilya Streltsyn Jul 31 '13 at 18:38