IE Document mode is forced in IE 7 though I am using Edge + modernizr relation

I am using following code snippet to force IE’s latest mode to run. Though I am using “Edge”, for some reason IE is always opened in Document mode IE 7 standards.

<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<head>

    <!-- Meta-Information -->
    <title>DVS</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
</head>

I am working on an intranet site, so I have checked the tools -> compatibility settings -> display intranet sites in compatibility view is checked.

I thought this is the reason, my web page is getting opened in compatibility mode and there is no easy way around it as I can’t ask every user to change these settings.

I removed following modernizr code snippet from the html page and my web page opens in Document mode Internet explorer IE9 standards

<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->

Does anyone know what is the relation between document mode being set to 7 and above modernizr specific code snippet.

Note: I haven’t disabled “display intranet sites in compatibility view” settings, it is still checked and after removing modernizr my page loads in IE9 standards mode and displays correctly


Source: html

Leave a Reply