Force IE compatibility mode off using tags

后端 未结 12 1378
广开言路
广开言路 2020-11-22 07:56

I am doing work for a client who forces compatibility mode on all intranet sites. I was wondering if there is a tag I can put into my HTML that forces compatibility mode off

相关标签:
12条回答
  • 2020-11-22 08:32

    If you want each individual web page to load the chosen content and are using asp.net. Just apply it as the first tag under the heading tag in Views>shared>Layout.cshtml

    just a tip

    0 讨论(0)
  • 2020-11-22 08:33

    This is due to the setting within IE Compatibility settings which says that all Intranet sites should run in compatibility mode. You can untick this via a group policy (or just plain unticking it in IE), or you can set the following:

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    

    Apparently it is not possible to change the compatibility view settings as a group policy but it is something that can perhaps be changed in the registry, this meta tag works fine for me, I had to make the required attribute work as part of a html form, it worked in chrome and firefox but not IE.

    Here is a nice visual of what browsers support each individual html 5 element.

    http://html5readiness.com/

    Notice the one common denominator Google Chrome, it supports everything. Hope this is of help

    0 讨论(0)
  • 2020-11-22 08:33

    Insert as the very first item under the tag.

    This forces IE to render the page in the physical version of IE, and it ignores the Browser "Mode setting". This can be set in the developer tools, try changing it to a older version of IE to test, this should be ignored and the page should look exactly the same.

    0 讨论(0)
  • 2020-11-22 08:40

    Just a few more notes on this topic based on my recent experiences. The university I work for issues laptops with IE 8 set to compatibility mode for all Intranet Sites. I tried adding the meta tag to disable this mode for pages being served up by my site but IE consistently ignored this tag. As Lance mentioned in his post, adding a response header fixed this issue. This is how I set the header based on the HTML5 boilerplate method:

    <IfModule mod_headers.c>
      Header set X-UA-Compatible "IE=edge,chrome=1"
      # mod_headers can't match by content-type, but we don't want to send this header on *everything*...
      <FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webm|webp|woff|xml|xpi)$">
        Header unset X-UA-Compatible
      </FilesMatch>
    </IfModule>
    

    In order for this header to actually be sent, you have to make sure you have mod_headers turned on in Apache. If you want to make sure you have this mod turned on, put this in a page that can run php:

    <pre>
    <?php
        print_r(apache_get_modules());
    ?>
    </pre>
    
    0 讨论(0)
  • 2020-11-22 08:42

    If you're working with a page in the Intranet Zone, you may find that IE9 no matter what you do, is going into IE7 Compat mode.

    This is due to the setting within IE Compatibility settings which says that all Intranet sites should run in compatibility mode. You can untick this via a group policy (or just plain unticking it in IE), or you can set the following:

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    

    This works (as detailed in other answers), but may not initially appear so: it needs to come before the stylesheets are declared. If you don't, it is ignored.

    0 讨论(0)
  • 2020-11-22 08:43

    After many hours troubleshooting this stuff... Here are some quick highlights that helped us from the X-UA-Compatible docs: http://msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx#ctl00_contentContainer_ctl16

    Using <meta http-equiv="X-UA-Compatible" content=" _______ " />

    • The Standard User Agent modes (the non-emulate ones) ignore <!DOCTYPE> directives in your page and render based on the standards supported by that version of IE (e.g., IE=8 will better obey table border spacing and some pseudo selectors than IE=7).

    • Whereas, the Emulate modes tell IE to follow any <!DOCTYPE> directives in your page, rendering standards mode based the version you choose and quirks mode based on IE=5

    • Possible values for the content attribute are:

      content="IE=5"

      content="IE=7"

      content="IE=EmulateIE7"

      content="IE=8"

      content="IE=EmulateIE8"

      content="IE=9"

      content="IE=EmulateIE9"

      content="IE=edge"

    0 讨论(0)
提交回复
热议问题