Object does not support property keys or method - (IE11)

I can not understand what the problem is in IE11 .
The app works well without any problems in other browsers like chrome, firefox, etc.


enter image description here

+6
source share
3 answers

You need to enable es6-shim because IE 11 does not support Map.prototype.keys

https://github.com/paulmillr/es6-shim

Or you can import directly from cdn:

 <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.4.1/es5-shim.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.1/es6-shim.js"></script> 

Check related issues:

+13
source

"Using a keyword for an identifier in an invalid" in IE 11 is still a problem for Angular2 beta 6:

http://github.com/angular/angular/issues/6501

There is a workaround in the thread that works :

 // function.name (all IE) /*! @source http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie*/ if (!Object.hasOwnProperty('name')) { Object.defineProperty(Function.prototype, 'name', { get: function() { var matches = this.toString().match(/^\s*function\s*(\S[^\(]*)\s*\(/); var name = matches && matches.length > 1 ? matches[1] : ""; // For better performance only parse once, and then cache the // result through a new accessor for repeated access. Object.defineProperty(this, 'name', {value: name}); return name; } }); } 
+1
source

I encountered the same error when using webpack and 2.0.0.rc1.

If anyone has the same problem, here is how I did it.

I basically included scripts in index.html

 es6-shim.min.js system-polyfills.js shims_for_IE.js 

when the browser is IE or Safari.

0
source

All Articles