本文介绍了Html 5重置(html5reset.org) - X-UA兼容不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 我在 html5reset.org 上使用优秀的HTML 5重置模板,而我的X-UA兼容元标记似乎不起作用。以下是我的标题:I'm using the excellent HTML 5 Reset template at html5reset.org and my X-UA-Compatible meta tag doesn't seem to work. Here is what my header looks like:<!DOCTYPE html><!--[if lt IE 7 ]> <html class="ie ieNoHtml5 ie6 no-js" lang="en"> <![endif]--><!--[if IE 7 ]> <html class="ie ieNoHtml5 ie7 no-js" lang="en"> <![endif]--><!--[if IE 8 ]> <html class="ie ieNoHtml5 ie8 no-js" lang="en"> <![endif]--><!--[if IE 9 ]> <html class="ie ie9 no-js" lang="en"> <![endif]--><!--[if (gt IE 9)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]--><!-- the "no-js" class is for Modernizr. --><head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title>Title of Page</title>显示在IE中使用兼容性视图模式的选项(URL字段中的损坏页面图标)。问题是我的一些客户已将IE9浏览器设置为始终使用兼容性视图模式,结果是网站看起来像IE7,即使他们使用的是IE9,而X-UA-Compatible也可以覆盖这个。The option to use compatibility view mode in IE is displayed (broken page icon in URL field). The problem is that some of my clients have set their IE9 browsers into 'always use compatibility view' mode, the result being that the website looks like IE7 even though they're using IE9, and X-UA-Compatible is suppose to override this.现在,如果我删除有趣的标题内容:Now if I remove the funny header stuff:<!DOCTYPE html><html class="no-js" lang="en"><head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> ......它突然开始正常工作。...it suddenly starts working fine.我注意到 html5reset.org 本身似乎显示了损坏的页面图标,因此它似乎也不起作用,但 html5boilerplate.com 工作,似乎使用相同的方法。I've noticed that html5reset.org itself seems to display the broken page icon, so it doesn't seem to work either, but html5boilerplate.com DOES work, and seems to use the same approach.添加X- UA-通过webserver配置与响应头兼容似乎可以修复它,但我宁愿不依赖这种方法。Adding the X-UA-Compatible into the response header via webserver config seems to fix it, but I'd rather not rely on this approach. 更新: html5boilerplate.com 似乎只是在HTTP响应标头中发送X-UA兼容检测到浏览器是IE。这似乎是要走的路。Update: It seems that html5boilerplate.com is just sending X-UA-Compatible in the HTTP response headers if it detects that the browser is IE. This seems the way to go.推荐答案 HTML5 Boilerplate建议使用webserver配置。它更快并且解决了标记解决方案无法使用的一些边缘情况: https://github.com/h5bp/html5-boilerplate/blob/v4.0.0/doc/html.md#x-ua-compatibleHTML5 Boilerplate recommends the webserver config. It's faster and solves a few edge cases that the markup solution doesn't work with: https://github.com/h5bp/html5-boilerplate/blob/v4.0.0/doc/html.md#x-ua-compatible 这篇关于Html 5重置(html5reset.org) - X-UA兼容不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的.. 09-08 17:58