开发者

Ensuring strict mode in IE 8

开发者 https://www.devze.com 2022-12-31 07:49 出处:网络
I\'m apparently triggering quirks mode (or at least IE 7 standards mode) even though I\'ve added the strict doctype:

I'm apparently triggering quirks mode (or at least IE 7 standards mode) even though I've added the strict doctype:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

and the IE compatibility list meta:

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

I've looked at the 开发者_StackOverflowDeveloper Tools window for the page, and it says that the page default is IE 8 standards mode, but still renders the page wrongly. However, changing the mode in developer tools to another mode and then switching back to IE 8 standards mode causes the page to render correctly.

Is there some other IE-specific incantation that I'm missing, or is this a known bug for IE 8 (or the IE Developer Tools)?

If it helps, here are the first few lines of the page (Sorry I don't have a link to the page, it's a proprietary product that is intended for deployment on intranets). I've checked that nothing comes before the DOCTYPE (though that apparently is no longer an issue for IE 8):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
      <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <!-- to override ie compatibility mode for intranets: http://blogs.msdn.com/b/ie/archive/2009/02/16/just-the-facts-recap-of-compatibility-view.aspx -->
        <meta http-equiv="X-UA-Compatible" content="IE=8" /> 


Either change your DOCTYPE to an XHTML one, or remove your self-closing tags.


I have encountered identical problem as Neil Ongkingco described. We've added a DOCTYPE, and the developer tool shows that the IE is rendering in IE8 Standard Mode. However, the webpage do not render as we expected. Changing the mode back and forth fixes the problem for that session, but it's not working as described. Here is what we've done to fix the problem.

  1. We kept the DOCTYPE as below. I don't think it matters whether you have Loose or Strict mode.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  2. Added the X-UA-Compatible metatag as described. We left out the closing slash as shown below.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消