如何更新网站以与 Internet Explorer 9 兼容?
当我在 Internet Explorer 9 中启动站点时,我开始收到脚本错误消息。我阅读了对 Internet Explorer 的支持,发现由于某些网站是为较旧的浏览器设计的,因此在网站针对 Internet Explorer 9 进行更新之前会出现兼容性问题。
我发现我可以将此代码添加
void Application_BeginRequest()
{
Response.AppendHeader("X-UA-Compatible", "IE=EmulateIE8");
}
到 Global.asax 文件中来处理这个问题。我收到的错误来自 IE9。
编辑:错误已修复,但我想知道是否有其他方法可以使网站与 IE9 兼容?另外IE8和IE9解释Javascript代码的方式有什么区别?
when I launched my site within Internet Explorer 9 I began receiving script error messages. I read the support for Internet Explorer and found out that because some sites are designed for older browsers there'll be compatibility issues until the sites are updated for Internet Explorer 9.
I found that I could add this code :
void Application_BeginRequest()
{
Response.AppendHeader("X-UA-Compatible", "IE=EmulateIE8");
}
to the Global.asax file to deal with the issue. The errors I received were from IE9.
EDIT: The errors were fixed but I want to know if there is an alternative method to making a website compatible with IE9? Also what are the differences between the way IE8 interprets Javascript code and IE9?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你所做的是正确的。这是处理此问题的服务器端方法之一。或者,您可以在 HTML 标头中进行设置(这会很痛苦,因为您必须对所有页面执行此操作)
在相关注释中 - 阅读 IE 兼容性博客,其中包含有关此主题的更多详细信息:
http://blogs.msdn.com /b/ie/archive/2010/06/16/ie-s-compatibility-features-for-site-developers.aspx
What you did is correct. This is one of the server side way to handle this. Alternately, you can set this in HTML header (will be painful as you have to do it for all the pages)
On a related note - read the IE compatibility blog which has more details on this topic:
http://blogs.msdn.com/b/ie/archive/2010/06/16/ie-s-compatibility-features-for-site-developers.aspx