如何更新网站以与 Internet Explorer 9 兼容?

发布于 2024-10-24 19:47:49 字数 421 浏览 2 评论 0原文

当我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尐籹人 2024-10-31 19:47:49

你所做的是正确的。这是处理此问题的服务器端方法之一。或者,您可以在 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文