Skip to content

Instantly share code, notes, and snippets.

@srkmrs
Created August 29, 2013 12:51
Show Gist options
  • Select an option

  • Save srkmrs/6377677 to your computer and use it in GitHub Desktop.

Select an option

Save srkmrs/6377677 to your computer and use it in GitHub Desktop.

Revisions

  1. srkmrs created this gist Aug 29, 2013.
    45 changes: 45 additions & 0 deletions ie_compatibility_mode
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    <!DOCTYPE html>
    <!DOCTYPE html>
    <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
    <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
    <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
    <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta charset="utf-8">
    <title>Browser Mode - Compat View</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="robots" content="noindex, nofollow">
    </head>
    <body>

    <!--[if lte IE 7]>
    <p id="chromeframe" class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
    <![endif]-->
    <!--[if IE]>
    <script>
    if(navigator.userAgent.indexOf("Trident")>-1){
    document.getElementById("chromeframe").style.display="none";
    }
    </script>
    <![endif]-->

    <!-- Add your site or application content here -->
    Please change your 'Browser Mode' and check it.

    <br/>
    <p>
    After research, we can find that the values to the User Agent String under different browse modes are:
    <ul>
    <li>IE7: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1;...)</li>
    <li>IE8: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0;...)</li>
    <li>IE8 Compatibility View: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0;...)</li>
    <li>IE9: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)</li>
    <li>IE9 Compatibility View: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0;...)</li>
    </ul>
    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.
    </p>

    </body>
    </html>