tpe*_*tpe 5 .net asp.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?).然而,这在这里没有多大帮助,因为javascript是框架的一部分,而不是我的代码.
我在这里找到了框架的javascript源代码:http: //ajaxcontroltoolkit.codeplex.com/SourceControl/latest#Client/MicrosoftAjax/Extensions/Sys/WebForms/PageRequestManager.js
// DevDiv Bugs 100201: IE does not set referrer header on redirect if you set window.location, inject anchor node instead
// dynamic anchor technique only works on IE
if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
var anchor = document.createElement("a");
anchor.style.display = 'none';
// cancel bubble so body.onclick is not raised
anchor.attachEvent("onclick", cancelBubble);
// more code...
}
Run Code Online (Sandbox Code Playgroud)
根据我的理解,这是Sys.Webforms.PageRequestManager模块,它是核心ASP.NET框架的一部分.
执行attachEvent的行在Internet Explorer 11上出现脚本错误,但在旧版本的Internet Explorer上运行良好.
如何解决这个问题?有没有已知的解决方法?我无法对此进行任何更新.
尝试强制浏览器在IE 10模式下渲染...
<meta http-equiv="X-UA-Compatible" content="IE=10" />
Run Code Online (Sandbox Code Playgroud)