“对象不支持此属性或方法". IE11中的错误

“对象不支持此属性或方法

问题描述:

我遇到了错误

严重错误:对象不支持此属性或方法addeventlistener

Critical Error: Object doesn't support this property or method addeventlistener

在IE 11浏览器中访问InfoPath表单页面(使用启用了InfoPath的列表表单,例如displayifs.aspx)时

.

while accessing the InfoPath form page (using InfoPath enabled list form e.g. displayifs.aspx) in IE 11 browser.

此错误特定于IE 11,该页面已在IE 10及以下版本中正确打开.根据此MSDN帖子 ,IE 11支持addEventListener.

This error is specific to IE 11, the page is opening properly in IE 10 and below. According to this MSDN post, IE 11 supports addEventListener.

有人对此有想法吗?

不幸的是,这破坏了其他事情.这是我在另一个网站上找到的修复程序为我工作:

This unfortunately breaks other things. Here is the fix I found on another site that seemed to work for me:

我想将X-UA-Compatible保留为"IE=8"并将以下代码添加到母版页的底部:

I'd say leave the X-UA-Compatible as "IE=8" and add the following code to the bottom of your master page:

<script language="javascript">
    /* IE11 Fix for SP2010 */
    if (typeof(UserAgentInfo) != 'undefined' && !window.addEventListener) 
    {
        UserAgentInfo.strBrowser=1; 
    } 
</script>

这修复了core.js中的错误,该错误地错误地计算了对IE11设置UserAgentInfo.strBrowse=3的设置,从而支持了addEventListener.除此以外,我不确定其他细节,但保持IE = 8并使用此脚本的组合对我来说是可行的.直到我找到下一个IE11/SharePoint错误"为止!

This fixes a bug in core.js which incorrectly calculates that sets UserAgentInfo.strBrowse=3 for IE11 and thus supporting addEventListener. I'm not entirely sure on the details other than that but the combination of keeping IE=8 and using this script is working for me. Fingers crossed until I find the next IE11/SharePoint "bug"!