4

I have an extremely strange issue: I try to debug (F12) a web application in IE 10. When the console is turned off the issue is active. As soon as the console is turned on (off) once, the issue disappears.

What does the console change on the rendering engine or DOM tree? Is there a tweak how I can enable the console automatically?

Without console: Screenshot

With console (turned on for a couple of seconds): Screenshot

Please let me know if you wish more details from my side.

Markus
  • 763
  • 7
  • 24
  • Have you tried triggering a repaint? `element.className = element.className` may do it. – alex Aug 28 '13 at 06:39
  • possible duplicate of [Why Javascript only works after opening developer tools in IE once?](http://stackoverflow.com/questions/7742781/why-javascript-only-works-after-opening-developer-tools-in-ie-once) –  Nov 28 '14 at 18:09

1 Answers1

5

Often times this is the result of an unchecked console.log in your script. Confirm that code writing to the console is preceded by a check to see if window.console exists.

var someVar = 1234;

//Fatal JS error, when devtools are closed:
console.log(someVar);

//Safely checked!
if (window.console) console.log(someVar);
Everett Green
  • 632
  • 3
  • 8