Magician
Magician

Reputation: 87

IE8 forcing document mode as IE7 standards

For my webapplication I am using IE8 as a standard browser.Sometimes the browser is setting Document mode as IE-7 Standards.

I have already tried Servlet Headers as IE=8,IE=edge and all other settings,also my DOCTYPE is also proper.

Does anyone knows why IE is forcing such behaviour ?

Upvotes: 2

Views: 2671

Answers (2)

vladimir
vladimir

Reputation: 15218

I resolved similar issue like this:

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

Take into account IE version should start from the lowest version.

Upvotes: 0

giammin
giammin

Reputation: 18958

You can force IE to use compatibility mode with X-UA-Compatible Meta Tag:

IE 7:

<meta http-equiv="X-UA-Compatible" value="IE=7">

IE 8:

<meta http-equiv="X-UA-Compatible" value="IE=8">

IE 9:

<meta http-equiv="X-UA-Compatible" value="IE=9">

IE look also at the page DOCTYPE:

Standards View

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>This page is NOT Rendered in Compatibility View</title>
  </head>
  <body>
    <h1>This page is NOT Compatibility View</h1>
  </body>
</html>

Compatibility View

<html>
  <head>
    <title>This page is NOT Rendered in Compatibility View</title>
  </head>
  <body>
    <h1>This page is NOT Compatibility View</h1>
  </body>
</html>

Standards View

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>This page is NOT Rendered in Compatibility View</title>
  </head>
  <body>
    <h1>This page is NOT Compatibility View</h1>
  </body>
</html>

Compatibility View

<?xml version="1.0" encoding="UTF-8">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>This page is NOT Rendered in Compatibility View</title>
  </head>
  <body>
    <h1>This page is NOT Compatibility View</h1>
  </body>
</html>

Note, that last example should load as standards view in XHTML mode. But Internet Explorer interprets that XML declaration as requiring compatibility view.

Upvotes: 2

Related Questions