1

I have a page with JS code. When I open this page in IE9, the code isn't run. However, when I open console with F12 and reload the page the script starts executing. What could be wrong here?

Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488

1 Answers1

3

Check for the JS error icon on the status bar. You probably are getting something about how console.log doesn't exist because it doesn't until you open the developer tools (in IE).

A fix for this in your code would be to check for the existence of console.log and if it doesn't exist, create one.

if (typeof console !== 'object' || typeof console.log !== 'function') {
    console.log = function (arg) {
        //now you can alert the argument or do whatever even when console.log isn't natively supported
    }
}
Jasper
  • 75,717
  • 14
  • 151
  • 146