Internet explorer 8 IE8强制文档模式为IE7标准

Internet explorer 8 IE8强制文档模式为IE7标准,internet-explorer-8,Internet Explorer 8,对于我的Web应用程序,我使用IE8作为标准浏览器。有时浏览器将文档模式设置为IE-7标准 我已经尝试了Servlet头的IE=8、IE=edge和所有其他设置,而且我的DOCTYPE也是正确的 有人知道IE为什么会强制这样做吗?您可以强制IE使用兼容模式: IE 7: IE 8: IE 9: IE还可以查看页面DOCTYPE: 标准视图 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http:/

对于我的Web应用程序,我使用IE8作为标准浏览器。有时浏览器将文档模式设置为IE-7标准

我已经尝试了Servlet头的IE=8、IE=edge和所有其他设置,而且我的DOCTYPE也是正确的


有人知道IE为什么会强制这样做吗?

您可以强制IE使用兼容模式:

IE 7:


IE 8:


IE 9:


IE还可以查看页面DOCTYPE:

标准视图

<!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>
<html>
  <head>
    <title>This page is NOT Rendered in Compatibility View</title>
  </head>
  <body>
    <h1>This page is NOT Compatibility View</h1>
  </body>
</html>
<!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>
<?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>

此页面未在兼容性视图中呈现
此页不是兼容视图
兼容性视图

<!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>
<html>
  <head>
    <title>This page is NOT Rendered in Compatibility View</title>
  </head>
  <body>
    <h1>This page is NOT Compatibility View</h1>
  </body>
</html>
<!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>
<?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>

此页面未在兼容性视图中呈现
此页不是兼容视图
标准视图

<!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>
<html>
  <head>
    <title>This page is NOT Rendered in Compatibility View</title>
  </head>
  <body>
    <h1>This page is NOT Compatibility View</h1>
  </body>
</html>
<!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>
<?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>

此页面未在兼容性视图中呈现
此页不是兼容视图
兼容性视图

<!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>
<html>
  <head>
    <title>This page is NOT Rendered in Compatibility View</title>
  </head>
  <body>
    <h1>This page is NOT Compatibility View</h1>
  </body>
</html>
<!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>
<?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>

此页面未在兼容性视图中呈现
此页不是兼容视图

注意,最后一个示例应该以XHTML模式作为标准视图加载。但Internet Explorer将该XML声明解释为需要兼容性视图。

我解决了类似的问题,如下所示:

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


考虑到IE版本应该从最低版本开始。

您能否共享使用的doctype和meta标记检查您的doctype是否正确。如果不正确。然后它将强制进入怪癖模式。您使用的是哪台服务器(iis、apache)?这是元标记:-这是Doctype@MAGISTER在标题部分是的,我已经添加了元标记。没有其他元标记。如果我手动更改文档模式,它会工作,但有时我会遇到相同的问题。我已经检查了所有内容,甚至代码也经过了验证,因此没有代码级错误。@MAGISTER你在用XHTML吗?@魔术师你看到我的例子了吗?