IE9中的Jquery 2.1.1得到错误:0x800a01b6-Microsoft JScript运行时错误:对象不支持属性或方法'addEventListener' [英] Jquery 2.1.1 in IE9 get error: 0x800a01b6 - Microsoft JScript runtime error: Object doesn't support property or method 'addEventListener'

查看:229
本文介绍了IE9中的Jquery 2.1.1得到错误:0x800a01b6-Microsoft JScript运行时错误:对象不支持属性或方法'addEventListener'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Visual Studio 2013将混合的Asp.Net Webforms / MVC 3 Web应用程序迁移到Asp.Net Webforms / MVC 5.1。作为迁移的一部分,我使用NuGet软件包管理器将Jquery从1.9.1升级到2.1.1。

Using Visual Studio 2013, I migrated a hybrid Asp.Net Webforms/MVC 3 web application to Asp.Net Webforms/MVC 5.1. As part of the migration I upgraded Jquery from 1.9.1 to 2.1.1, using the NuGet package manager.

当我在Visual Studio 2013调试器中运行应用程序时Chrome浏览器我没问题。

When I run the application in the Visual Studio 2013 debugger in Chrome I have no problem.

当我在IE 9中的Visual Studio 2013调试器中运行应用程序时(不启用兼容模式),具有这两个脚本标签的母版页首先加载:

When I run the application in the Visual Studio 2013 debugger in IE 9 (compatibilty mode is not on) a master page with these two script tags loads first:

<script src="/Scripts/jquery-2.1.1.js" type="text/javascript"></script>
<script src="/Scripts/jquery-ui-1.10.4.js" type="text/javascript"></script>

此Javascript错误导致失败:

It fails with this Javascript error:

Unhandled exception at line 3425, column 4 in http://localhost:25378/Scripts/jquery-2.1.1.js 
0x800a01b6 - Microsoft JScript runtime error: Object doesn't support property or method 'addEventListener'

我意识到Jquery 2不适用于IE 8及以下版本,但是我找不到任何文档来说明IE 9的任何问题。

I realize that Jquery 2 does not work with IE 8 and below, but I cannot find any documentation noting any issues with IE 9.

该错误发生在jQuery.ready.promise的jquery-2.1.1.js的第3425行上函数:

The error occurs on line 3425 of jquery-2.1.1.js inside the jQuery.ready.promise function:

document.addEventListener( "DOMContentLoaded", completed, false );

奇怪的是,当我停止错误时,请在调试器中检查文档对象并展开方法在节点上,我可以看到 addEventListener方法。就像Jquery没有权限查看该方法一样。

Strangely, when I stop at the error, examine the document object in the debugger and expand the "Methods" node I can see the "addEventListener" method. It is as if Jquery does not have rights to see the method.

我非常想升级到Jquery 2,并从我读过Jquery的所有内容开始2应该与IE9一起使用。有关解决此问题的任何建议?

I'd very much like to move up to Jquery 2, and from everything I've read Jquery 2 should work with IE9. Any advice on fixing this issue?

推荐答案

感谢ᾠῗᵲᄐᶌ和QBM5的评论,在这种情况下,答案是删除

Thank you ᾠῗᵲᄐᶌ and QBM5 for your comments, the answer in this case was to remove

<meta http-equiv="X-UA-Compatible" content="IE=8">

来自母版页标题,因为它将浏览器置于IE 8兼容模式,而IE 8是与JQuery 2不兼容。

from the master page header, because it put the browser into IE 8 compatibility mode, and IE 8 is not compatible with JQuery 2.

这篇关于IE9中的Jquery 2.1.1得到错误:0x800a01b6-Microsoft JScript运行时错误:对象不支持属性或方法'addEventListener'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆