开发者

IE runs JavaScript only after pressing F12

开发者 https://www.devze.com 2023-04-10 02:16 出处:网络
I have a strange problem in Interne开发者_运维问答t Explorer with JavaScript. In every browser I did the test the JavaScript is enabled, but it seems to run only after I press the F12, running it in d

I have a strange problem in Interne开发者_运维问答t Explorer with JavaScript. In every browser I did the test the JavaScript is enabled, but it seems to run only after I press the F12, running it in debug mode. And what is more confusing, after starting the IE debugger everything is working as suppose to.

Any ideas what it could be?


If you're calling:

console.log('...some text here...');

or any related method of console without having checked if window.console exists, the script will fail silently. Opening the console leads to window.console existing, which allows the script to continue execution.

Add "window.console && " before your calls to console:

window.console && console.log('works');
0

精彩评论

暂无评论...
验证码 换一张
取 消