IE8标准模式元标记 [英] IE8 standards mode meta tag
问题描述
我们为一个正在将其标准浏览器从IE6升级到IE8(队列庆祝活动)的组织的Web应用程序,我们已将所有DOCTYPE设置为<!DOCTYPE html>
(以及固定的其他HTML代码),我认为在IE8中这会导致页面在IE8标准模式下呈现。但是,它仍然显示在IE7标准模式下。
我添加了< meta http-equiv =X-UA兼容content =IE = 8>
放入< head>
部分,但它仍然无法默认使用IE8标准模式。我假设在这个阶段,必须有一个设置(也许是组策略等),这是强制模式。
在MSDN论坛上阅读黑客之后,如果您将元标记放在< html>
标记之前,它会正确显示为IE8标准模式,并且这对我有效。有没有另一种方法来做到这一点?它看起来很糟糕,看到那里的元标记...
大致如何构成每个页面:
<!DOCTYPE html>
< meta http-equiv =X-UA-Compatiblecontent =IE = 8>
< html lang =en>
< head>
< meta charset =utf-8>
< title>页面标题< / title>
< / head>
< body>
< / body>
< / html>
您可以设置 X- UA兼容
作为HTTP响应头,而不是元标记。
这比将它放在< html>
标记。
一个令人困惑的 c> X-UA兼容及其许多复杂性:
http://farukat.es/journal/2009/05/245-ie8-and-the-x-ua-compatible-situation
A web application we have for an organisation that is officially upgrading its standard browser from IE6 to IE8 (queue celebrations), we've set all our DOCTYPEs to be <!DOCTYPE html>
(as well as fixed other html code) and I thought that in IE8 this would cause the page to be rendered in IE8 Standards Mode. However, it is still shown in IE7 Standards mode.
I've added the <meta http-equiv="X-UA-Compatible" content="IE=8">
into the <head>
section and it still fails to default to IE8 Standards mode. I'm presuming at this stage that there must be a setting (perhaps Group Policy etc) that is forcing the mode.
After reading a hack on an MSDN forum that if you put the meta tag before the <html>
tag, it correctly displays as IE8 Standards mode, and this worked for me. Is there another way to do this? It just looks terrible seeing the meta tag there...
Here's roughly how each page is made up:
<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Title</title>
</head>
<body>
</body>
</html>
You could set X-UA-Compatible
as a HTTP response header, instead of as a meta tag.
This is a much cleaner solution than placing it above the <html>
tag.
A confusing useful blog post concerning X-UA-Compatible
and its many intricacies:
http://farukat.es/journal/2009/05/245-ie8-and-the-x-ua-compatible-situation
这篇关于IE8标准模式元标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!