IE9: Script only works in debugger, but not when NOT debugging

你。 提交于 2020-01-01 10:57:09

问题


I have some trouble with Internet Explorer's compatibility. I'm building an online tool with massive usage of HTML5 canvas, CSS3 and JavaScript. The program works fine in all major browsers, except for Internet Explorer.

IE9 switched into compatibility mode, so I set

<meta http-equiv="x-ua-compatible" content="IE=9"/>

to force IE to process the page with IE9 standards. IE does no longer fall into compatibility mode, but the script does still not work properly. Some basic functionality as drawing or dragging objects works, but only "half".

What does a programmer do in this case: He starts the debugger. And that's where the magic happens. As soon as I start the IE9 developer tools (with IE9 browser and document mode as well), the script works properly. But how should I debug a script which works fine under debugging conditions, and has errors when not debugging.

Currently, I have no clue what to do. Maybe someone can give me a hint? Thanks a lot!


回答1:


IE9 doesn't like console calls, and without showing us any code we can only guess what the issue is. You can either remove any console.log messages or use this snippet before any code is called:

(!window.console) console = {log: function() {}};


来源:https://stackoverflow.com/questions/15949819/ie9-script-only-works-in-debugger-but-not-when-not-debugging

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