user1620122 user1620122 - 1 year ago 352
React JSX Question

React JS not working with Internet Explorer 9

I'm trying to use React with Internet Explorer 9 but getting the following errors even trying to run something very barebones:

SCRIPT438: Object doesn't support property or method 'isArray'
react-with-addons.js, line 4 character 317

SCRIPT438: Object doesn't support property or method 'create'
JSXTransformer.js, line 4 character 326

I've read, which says IE8 might have these issues, but no mention about IE9. Googling didn't really bring up any solutions either.

Still, I tried adding es5-shim/sham as suggested on that page. That results in a different error:

SCRIPT438: Object doesn't support property or method 'hasAttribute'
es5-shim.min.js, line 6 character 4143

Has anyone encountered these errors before in IE9 or otherwise?

Thanks for the help!

The full code I'm trying to run is:

<script src="js/es5-shim.min.js"></script>
<script src="js/es5-sham.min.js"></script>
<script src=""></script>
<script src="js/react-with-addons.js"></script>
<script src="js/JSXTransformer.js"></script>

<div id="container"></div>
<script type="text/jsx">
<h1>HELLO WORLD!</h1>

Answer Source

General You need to include the specified poly fills for ES5 features (as you've noticed): You may also need HTMl5 shiv in addition to the the poly-fills you've provided.

More specifically though the problem is probably not with poly fills but with the document mode IE9 is running in. You want to make sure that you are setting the correct document mode in your HTML file so IE, knows which version to target. Otherwise even though you are using IE9 it may be targeting IE7 which is no good.

<meta http-equiv="X-UA-Compatible" content="IE=edge">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download