Document Information

Last modified:
2009/09/04 16:15 by chris_schmidt

Internet Explorer 8 Modes

IE8 supports the following three modes:

  • Quirks mode (IE5 mode)
  • Internet Explorer 7 standard mode
  • Internet Explorer 8 standard mode

The Internet Explorer 8 User-Agent String

The IE8 has two different User-Agent strings. If the IE 8 doesn’t run in Compatibility View he sends a string containing MSIE 8.0 and Trident/4.0:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)

But if the Compatibility View is enabled, the User-Agent string changed to:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0)

Warning!

The IE8 only change User-Agent string, but these doesn’t say something about in which mode the IE runs. The information in which mode the IE runs is only accessible with the document.documentMode.

For more details have a look at: The Internet Explorer 8 User-Agent String

How-to run the different modes

There are two alternative ways to select the mode Internet Explorer 8 runs in:

  • Use a certain meta tag in your HTML file
  • Use a custom HTTP request header

Internet Explorer 8 knows five tags to run the three modes. The table below shows, which tag should be used to run the Internet Explorer 8 in either of the modes:

Tag Mode Description
IE=5 Quirks Runs IE8 in Quirks mode
IE=7 IE7 standard Runs IE8 in IE7 standard mode
IE=8 IE8 standard Runs IE8 in IE8 standard mode
IE=EmulateIE7 Quirks or IE7 standard Runs IE8 in Quirks mode if no <!DOCTYPE> is defined, otherwise it runs in IE7 standard mode
IE=Edge IE8 standard or better Runs IE8 in the “best” available mode, currently this is IE8 standard mode, but could later be IE9, and so on

Use a certain meta tag in your HTML file

To select the mode in an HTML file, you must set a certain <meta> tag. This <meta> tag must be the first tag in the <head> tag. The example below demonstrates how to run the document in IE7 standard mode.

<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>My Web Page</title>
  </head>
  <body>
    <p>Content goes here.</p>
   </body>
</html>

Note, if you set the content to “IE=EmulateIE7” then internet Explorer 8 will switch to “Quirks mode”, because the HTML file above has no <!DOCTYPE> defined.

The table above shows which tags can be used to run other modes.

Use a custom HTTP request header

Another technique is to use a custom HTTP request header to set the Internet Explorer 8 mode. The advantage is that you must not edit any HTML files to set the mode.

You have to add a “X-UA-Compatible” key, let’s say with a value “IE=7” to run the IE7 standard mode.

An example to add a custom HTTP request header in Apache 2.2:

#Add header module
LoadModule headers_module modules/mod_headers.so

#Set header for all requests to IE7 standard mode
Header set X-UA-Compatible: IE=7

The table above shows which tags can be used to run other modes.

Information

Last modified:
2009/09/04 16:15 by chris_schmidt

Account

Not logged in

 
 

Rich Ajax Platform (RAP)

RAP uses qooxdoo, Java and the Eclipse development model to build rich web applications. Read more...

qooxdoo Web Toolkit (QWT)

Similar to GWT this framework allows to create impressive qooxdoo applications just using Java. Read more...

Pustefix

Pustefix is a MVC-based web application framework using Java and XML/XSLT. Read more...

 
SourceForge.net Logo

Bad Behavior has blocked 0 potential spam attempts in the last 7 days.