- The experience you're describing is typical of code which contain
console.log()or any of the other
- The console object is only activated when the Dev Toolbar is opened. Prior to that, calling the console object will result in it being reported as
undefined. After the toolbar has been opened, the console will exist (even if the toolbar is subsequently closed), so our console calls will then work.
- There are a few Solutions to this:
- The most obvious one is to go through our code removing references to
console. We shouldn't be leaving stuff like that in production code anyway.
- If we want to keep the console references, we could wrap them in an if() statement, or some other conditional which checks whether the console object exists before trying to call it.
HTML5 Boilerplate has a nice pre-made code for console problems fixing:
- Here's another possible reason besides the
console.logissue (at least in IE11):
- When the console is not open, IE does pretty aggressive caching, so make sure that any
XMLHttpRequestcalls have caching set to false.
- For example:
When the developer console is open, caching is less aggressive. Seems to be a bug.
This solved my problem after we made a minor change to it. we added the following in my html page in order to fix the IE9 problem:
This solution does not work on IE 11 on Windows 7 64-bit.