Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net Internet Explorer 11在PageRequestManager.js中出现脚本错误_Asp.net_.net_Asp.net Ajax_Internet Explorer 11 - Fatal编程技术网

Asp.net Internet Explorer 11在PageRequestManager.js中出现脚本错误

Asp.net Internet Explorer 11在PageRequestManager.js中出现脚本错误,asp.net,.net,asp.net-ajax,internet-explorer-11,Asp.net,.net,Asp.net Ajax,Internet Explorer 11,我在服务器上使用ASP.NET 4.5,我有一个带有Web浏览器控件的.NET Windows应用程序,可以导航到服务器上的网页 如果在带有Internet Explorer 11的系统上运行Windows应用程序,则在导航到另一个页面时会出现脚本错误:“对象不支持属性或方法‘attachEvent’”。脚本文件是ScriptResource.axd,因此它不是我的任何脚本 我知道Internet Explorer 11不再支持attachEvent(替换为attachEventListener

我在服务器上使用ASP.NET 4.5,我有一个带有Web浏览器控件的.NET Windows应用程序,可以导航到服务器上的网页

如果在带有Internet Explorer 11的系统上运行Windows应用程序,则在导航到另一个页面时会出现脚本错误:“对象不支持属性或方法‘attachEvent’”。脚本文件是ScriptResource.axd,因此它不是我的任何脚本

我知道Internet Explorer 11不再支持attachEvent(替换为attachEventListener?)。但是,这在这里没有多大帮助,因为javascript是框架的一部分,而不是在我的代码中

我在这里找到了框架的javascript源代码:

这是Sys.Webforms.PageRequestManager模块,据我所知,它是核心ASP.NET框架的一部分

执行attachEvent的行在Internet Explorer 11上给出了脚本错误,但在旧版本的Internet Explorer上效果很好


如何解决这个问题?是否有已知的解决方法?我无法对此进行任何更新。

尝试强制浏览器在IE 10模式下渲染

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

我在jQuery 1.10中遇到了这个问题,IE11似乎缺少对jQuery中使用的“attachEvent”的支持,您的框架似乎也使用了它。有一个Microsoft错误提示:

我找到了解决问题的办法。只需在框架之前插入以下代码:

var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/)); 
if (isIE11) {
    if (typeof window.attachEvent == "undefined" || !window.attachEvent) {
        window.attachEvent = window.addEventListener;
    }
} 

首先检查浏览器是否为IE11,然后再次绑定attachEvent侦听器,这样错误就不会再次发生。

谢谢,这个解决方法很好。但我们希望Sys.Webforms.PageRequestManager的框架代码在将来的版本中得到更正,以支持IE 11。另一个解决方法是简单地修补ajaxcontroltoolkit代码,因为该代码是开源的。但是你必须维护一个独立的代码分支,我不推荐这样做。。。
var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/)); 
if (isIE11) {
    if (typeof window.attachEvent == "undefined" || !window.attachEvent) {
        window.attachEvent = window.addEventListener;
    }
}