我正在经历一种相当奇怪的行为--我的RequireJS模块似乎根本没有在IE9下初始化和运行:
<head>
...
<script data-main="/static/js/main" src="/static/js/libs/require.js"></script> // Seems to be not running at all.
</head>然而,每当我启动IE9的开发工具并重新加载页面时,模块就会运行良好,就像在Firefox/Chrome/Safari/等等中一样。清理浏览器缓存并关闭IE9中的开发工具将使JavaScript不再完全运行。
启动RequireJS模块执行的另一种方法是在其前面添加一个同步脚本调用:
<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>看来,这种奇怪行为的原因可能是:
然而,为什么开发人员工具能够启动执行确实让我感到困惑。
寻找对这一现象的充分解释,以及如何解决它。
发布于 2012-10-10 07:37:57
找到了答案:在未打开dev工具时,console在IE9中是undefined,但是您永远看不到这个错误,因为该工具的控制台需要重新加载页面才能开始工作。
https://stackoverflow.com/questions/12746119
复制相似问题