Home  >  Article  >  Web Front-end  >  ie9 prompts 'console' undefined solution to the problem_javascript skills

ie9 prompts 'console' undefined solution to the problem_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:54:541762browse

The maintained project ran under IE9 without any problems. After adding the code, I found that it could not be fully displayed. After opening the developer tools of IE, it can be displayed completely. I searched for a long time but couldn't find the reason. Later I found that there was an output statement in the console after opening the developer tools. After turning off the developer tools, I found the prompt 'console' is undefined in the status bar. Why did the previous operation have no problem, but the subsequent one does not? I was puzzled, so I added the following code to the code:

Copy the code The code is as follows:

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. After searching, I found that it was caused by a problem with the definition of console in IE9.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn