“Object doesn't support this property or method” error in IE11

前端 未结 7 1038
野的像风
野的像风 2020-12-08 06:57

I am getting the error

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

while accessing the Info

相关标签:
7条回答
  • 2020-12-08 07:32

    We have set compatibility mode for IE11 to resolve an issue: Settings>Compatibility View Settings>Add your site name or Check "Display intranet sites in Compatibility View" if your portal is in the intranet.

    IE version 11.0.9600.16521

    Worked for us, hope this helps someone.

    0 讨论(0)
  • 2020-12-08 07:35

    Best way to solve this until a fix is available (if a fix comes) is to force IE compatibility mode on the user.

    Use <META http-equiv="X-UA-Compatible" content="IE=9"> ideally in the masterpage so all pages in your site get the workaround.

    0 讨论(0)
  • 2020-12-08 07:39

    Add the code snippet in JS file used in master page or used globally.

    <script language="javascript">
    if (typeof browseris !== 'undefined') {
        browseris.ie = false;
    }
    </script>
    

    For more information refer blog: http://blogs2share.blogspot.in/2016/11/object-doesnt-support-property-or.html

    0 讨论(0)
  • 2020-12-08 07:45

    What fixed this for me was that I had a React component being rendered prior to my core.js shim being loaded.

    import ReactComponent from '.'
    import 'core-js/es6'
    

    Loading the core-js prior to the ReactComponent fixed my issue

    import 'core-js/es6'
    import ReactComponent from '.'
    
    0 讨论(0)
  • 2020-12-08 07:51

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

    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>
    

    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"!

    0 讨论(0)
  • 2020-12-08 07:55

    I face the similar issue and surprisingly meta tag didn't work this time. Turns out the company I currently cooperate with has this enterprise mode setting which has priority over meta tag.

    We can't change the setting cause policy issue. Luckily I don't really need any fancy features but basic usage of jQuery so my final solution is to switch its version to 1.12 for better compatibility.

    ref: jQuery - Browser support

    0 讨论(0)
提交回复
热议问题