admin管理员组

文章数量:1309930

I have some trouble with Internet Explorer's patibility. 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 patibility mode, so I set

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

to force IE to process the page with IE9 standards. IE does no longer fall into patibility 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!

I have some trouble with Internet Explorer's patibility. 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 patibility mode, so I set

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

to force IE to process the page with IE9 standards. IE does no longer fall into patibility 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!

Share Improve this question asked Apr 11, 2013 at 13:16 MichaelMichael 7,8398 gold badges46 silver badges91 bronze badges 5
  • Is there console lines in the code? Are there any error messages? – epascarello Commented Apr 11, 2013 at 13:18
  • 1 IE tends to crash on console.log() (and other console methods) unless the debugger is open - does your code use such methods? – nnnnnn Commented Apr 11, 2013 at 13:19
  • 2 Any reason you're not using IE=edge? Any users of your application on IE10 will be forced back to IE9 which could be detrimental – Aaron Powell Commented Apr 11, 2013 at 13:22
  • @nnnnnn Only in IE8 and below as console was not standardized. IE9+ will happily consume those errors – Aaron Powell Commented Apr 11, 2013 at 13:23
  • 1 Possible reason is asynchrous calls by timer via setInterval/setTimeout or inproper usage of asynchronous functions; in this cases code execution order may differs under debugger and in clean runtime. – Tommi Commented Apr 11, 2013 at 13:26
Add a ment  | 

1 Answer 1

Reset to default 9

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() {}};

本文标签: javascriptIE9 Script only works in debuggerbut not when NOT debuggingStack Overflow