IE compatibility mode error

Here is the code at the top of my page:

<!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 http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta charset="utf-8"> <title></title> ... 

I am using conditional comment code from Paul Irish to simplify the detection and resolution of IE problems, however this code seems to be causing the problem on its own. The problem is that using conditional comment code makes my page work in IE8 compatibility mode, even though I explicitly declare ie=edge in accordance with MSDN guidelines .

Removing the conditional comment code around the html tag fixes the crash and allows IE8 to render in standard mode; however, I would rather find a solution that allows me to preserve the conditional code and still force IE to display in compliance mode. Keep in mind that I do not have a .htaccess file to use as this site uses windows / asp installation.

+7
source share
5 answers
0
source

A blank comment at the beginning corrects it.

 <!--[if IE_NEEDS_THIS]><![endif]--> <!DOCTYPE HTML> <!--[if lt IE 9]><html class="lt-ie9"><![endif]--> <!--[if gt IE 8]><!--><html class="gt-ie8"><!--<![endif]--> <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <title>--</title> 

But do not put a conditional comment around the meta tag. IE10 will fall into quirks.

+7
source

I found if the comment is at the beginning of the documents, then the meta tag can also be in the comment.

It works anyway and then it is valid HTML5!

 <!–[if IE]><![endif]–> <!DOCTYPE html> <html lang="de"> <head> <title></title> <!–[if gte IE 8]><meta http-equiv="X-UA-Compatible" content="IE=Edge" /><![endif]–> 

In this situation, like IE8 and IE9, but not content="IE=Edge,Chrome"

So please content="IE-Edge"

+2
source

You said:

Keep in mind that I do not have a .htaccess file to use as this site uses windows / asp setup.

I assume this means that you can get around the problem by specifying X-UA-Compatible as the header of the HTTP response and not as a meta tag.

If you use Classic ASP, you can use this at the top of your file and get rid of the meta tag:
(I assume that you were referring to a classic ASP based on the lack of ASP.NET related things in your profile)

 Response.AddHeader "X-UA-Compatible", "IE=edge,chrome=1" 

This answer is based on too much guessing to my taste, so it may not work.

Also, this question may help:

IE8 Standards Meta Tag

0
source

The top answer is a dead link.

These problems with the Boilerplate helped me:

https://github.com/h5bp/html5-boilerplate/issues/125

https://github.com/h5bp/html5-boilerplate/issues/1187

The getetbro source code is correct, but these links will provide more information on why.

0
source

All Articles