I have a website hosted on the local intranet, mysite.mycompany.com, which triggers IE to use compatibility mode (IE-7 in my case) by default.
I want use the latest browser mode (hence the meta content="IE=Edge,chrome=1"
) and handle old versions robustly (display a message for less than IE9).
My problem is that the conditional comments are evaluated prior to the meta tags, so we're still in IE-7 mode when evaluating the conditionals. For example, the following HTML using IE9 on the local intranet displays: 'Tags LT IE9'.
What is the correct, robust way to handle this?
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
</head>
<body>
<!--[if lt IE 9]><p>Tags LT IE9</p><![endif]-->
</body>
</html>