RequireJS not working in IE9

梦想的初衷 提交于 2019-12-23 09:34:33

问题


I'm experiencing a fairly peculiar behavior - my RequireJS modules seem to be not initializing and running at all under IE9:

<head>
    ...
    <script data-main="/static/js/main" src="/static/js/libs/require.js"></script> // Seems to be not running at all.
</head>

However, whenever I fire up IE9's developer tool, and reload the page, the modules will be running fine just as they should in Firefox/Chrome/Safari/etc. Cleaning browser cache and closing the developer tool in IE9 will render the JavaScript not running entirely again.

Another way to kick-start the execution of the RequireJS modules is to add a synchronous script calling before it:

<head>
    ...
    <script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script> // Add any synchronous script calling here and the module below will execute fine.
    <script data-main="/static/js/main" src="/static/js/libs/require.js"></script>
</head>

It would appear that the reason of the weird behavior may either be:

  • Something went wrong with RequireJS' async loading
  • Something went wrong that caused scripts to launch before $.ready()

Why the developer tool can kick-start the execution really baffled me, though.

Looking for a full explanation to the phenomenon and how to solve it.


回答1:


Found the answer: console is undefined in IE9 when dev tool is not opened, but you never get to see this error since the tool's console requires a page reload to start working.

More details here: https://github.com/jrburke/requirejs/issues/488



来源:https://stackoverflow.com/questions/12746119/requirejs-not-working-in-ie9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!