1

I am creating a window variable in the script tag of my index.html page.

<head>
   <script>
     window.testing = "testing";
   </script>
</head>
<body>
   <div id="root"></div>
</body>

I am then trying to use this new variable in my react component in the render function. Its working for all the latest browsers but for IE its giving an error saying its undefined. Any idea what the problem might be?

EDIT: Possible solution: Why does IE nuke window.ABC variables?

I think its actually working for them, the problem there seems to be that a new variable declared with the same name as the window variable gets over ridden. For me, in my react render function the variable is coming as undefined even though I have assigned a value to it.

warhead
  • 241
  • 1
  • 3
  • 7
  • Possible duplicate of [Why does IE nuke window.ABC variables?](https://stackoverflow.com/questions/4606847/why-does-ie-nuke-window-abc-variables) – Simon Apr 05 '19 at 08:29
  • @Simon I think its actually working for them, the problem there seems to be that a new variable declared with the same name as the window variable gets over ridden. For me, in my react render function the variable is coming as undefined even though I have assigned a value to it. – warhead Apr 05 '19 at 08:38

0 Answers0