HTML 5 w3c 验证
我使用 validator.w3.org 验证了我的网站,
它报告了以下错误:
Line 5, Column 67: Bad value X-UA-Compatible for attribute http-equiv on element meta.
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
如果我不包含该 META 标记,则所有 IE9 访问者都会在 Quirks 模式下看到我的网站,我想防止这种情况发生。
任何帮助将不胜感激!
I validated my website using validator.w3.org
It reported the following error:
Line 5, Column 67: Bad value X-UA-Compatible for attribute http-equiv on element meta.
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
If I don't include that META tag, than all IE9 visitors will see my website in Quirks mode, and I want to prevent that.
Any help would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您始终可以将 X-UA-Compatible 设置放入实际的 HTTP 标头中。如何执行此操作取决于您正在使用的 Web 服务器,以及您正在使用的服务器端框架(如果有)。
You could always put the X-UA-Compatible setting into the actual HTTP headers instead. How you do that depends on the web server you are using, and what, if any, server-side framework you are using.
这里有同样的问题,但我的解决方案是以下行添加到我的 .htaccess 文件中:
对我来说效果很好...
Same problem here, but my solution is to add the following line to my .htaccess file:
Works great for me...
您必须接受这样一个事实:如果您想要 IE 支持,则需要放弃完美的验证分数。
不过没关系,
有效性!=质量
You'll just have to accept the fact that if you want IE support, you'll need to give up perfect validation score.
It's alright though,
validity != quality
对于使用PHP的人来说,在PHP中通过头函数传递这个参数的方式:
这里是aa 带有代码+解释的帖子。
For people using PHP, the way to pass this parameter through the header function in PHP:
Here is a a post with code + explanation.
解决方案非常简单,主题可以在功能模板中包含这个简单的解决方案
打开 /templates/YOUR TEMPLATE/warp/systems/themes/head.php
只需从
到
The solution is very simple and theme can include this easy in feature templates
just open /templates/YOUR TEMPLATE/warp/systems/themes/head.php
from
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
to
对于使用 ASP.NET MVC 的用户
一种选择是在控制器/操作上使用操作过滤器。这确实会减慢服务器的响应速度,但我不知道确切的数字。但这是一种干净的方法:
但是,对我来说绝对最好和最干净的方法是使用
web.config
。将此代码放入
元素中:显然这仅适用于 IIS7+。
华泰
For guys using ASP.NET MVC
One option is to use Action Filter on controllers/actions. This does slow down responses from the server a bit but I don't know the exact numbers. But it's a clean way to do it:
However, the absolutely best and cleanest way for me is using
web.config
. Put this code into<system.webServer>
element:Obviously this only works in IIS7+.
HTH
您是否尝试过不关心 HTML 验证器对您的代码的评价?这通常对我有用。
Have you tried not giving a damn what HTML validators say about your code? That usually works for me.