wasp256
wasp256

Reputation: 6252

IE8 documentMode always 'quirk mode'

I'm trying to print a message to the user when he is using an IE version bellow IE8. To test it I enabled the Document Mode 8. But when I ask for the Document Mode in javascript I always receive the 'quirk mode: 5'

 document.documentMode;

Does anyone know why?

Here is the beginning of my specification:

<!doctype html>
<html>
 <head>
   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
   <meta http-equiv="content-type" content="text/html; charset=UTF-8">
   ...

SOLVED:

I used the user-agent nevertheless and checked for the 'trident/4.0' tag which is displayed only in IE8

Upvotes: 0

Views: 362

Answers (2)

Simon West
Simon West

Reputation: 3788

There are a couple of things that can force IE into QuirksMode the most obvious two are

  1. A Missing, malformed or dated Doctype see the table near the bottom of this page for a comprehensive guide to which doctypes will trigger quirksmode
  2. Anything on the page before the DocType, IE insist on the DocType being the absolute first thing to appear in the file or it assumes no DocType and revers to QuirksMode

Upvotes: 1

Sudip
Sudip

Reputation: 2051

Use this meta tag in your page head section...

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

It'll finalized your document mode.

Upvotes: 0

Related Questions