如何在先前(IE7,IE5)渲染模式下设置IE8以实现向后兼容性

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在先前(IE7,IE5)渲染模式下设置IE8以实现向后兼容性相关的知识,希望对你有一定的参考价值。

„Versioning and Cross-document InteractionInternet Explorer 8 introduces the IE8 standards mode by default—this lets Web designers use the latest rendering features available in Internet Explorer 8. In addition to layout changes, IE8 standards mode will also affect the behavior of scripted APIs (DOM).
To opt-out of IE8 standards mode, the META tag may be used to obtain IE7 compatibility mode“

Take a look at http://code.google.com/p/ie7-js/ too.
This is a tiny JS library to makes IE versions behave like a standard browser.
  1. /* -- send as http header too -- */
  2. // in php
  3. header('X-UA-Compatible:IE=7');
  4.  
  5. <meta http-equiv="X-UA-Compatible" content="IE=7">
  6.  
  7. <meta http-equiv="X-UA-Compatible" content="IE=4"> <!-- IE5 mode -->
  8. <meta http-equiv="X-UA-Compatible" content="IE=7.5"> <!-- IE7 mode -->
  9. <meta http-equiv="X-UA-Compatible" content="IE=100"> <!-- IE8 mode -->
  10. <meta http-equiv="X-UA-Compatible" content="IE=a"> <!-- IE5 mode -->
  11.  
  12. <meta http-equiv="X-UA-Compatible" content="IE=7; IE=8" />
  13.  
  14. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
  15. <!-- Choose IE7 mode -->
  16. <meta http-equiv="X-UA-Compatible" content="IE=7" />
  17. <title>My Web Page</title>
  18. </head>
  19. <p>Content goes here.</p>
  20. </body>

以上是关于如何在先前(IE7,IE5)渲染模式下设置IE8以实现向后兼容性的主要内容,如果未能解决你的问题,请参考以下文章

文档模式

js强制不使用“兼容性视图”

添加http头以强制IE8在IE7模式下呈现

PHP 添加http标头以强制IE8在IE7模式下呈现(PHP-Version)

如何强制 Internet Explorer 以标准模式而不是 Quirks 模式呈现?

英特尔酷睿处理器和英特尔ie3\ie5\ie7处理器的区别