Ie9 prompts 'console' for not defining a solution to the problem

  • 2020-03-30 02:24:51
  • OfStack

Maintenance of the project running under ie9 without problems, after the new code can not be fully displayed. Open the ie developer tool and you'll be able to see the whole thing again. After a long search for a reason, I found an output statement on the console after opening the developer tool. After closing the developer tool, the status bar tells you that the 'console' is undefined. Why did it work before and not after? Puzzled, later in the code to add the following code:
 
window.console = window.console || (function(){ 
var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile = c.clear = c.exception = c.trace = c.assert = function(){}; 
return c; 
})(); 

Then the project is ready to run. A search revealed a problem with ie9's definition of the console.

Related articles: