IE runs javascript only after pressing F12

后端 未结 1 1965
无人及你
无人及你 2021-01-04 13:42

I have a strange problem in Internet Explorer with Javascript. In every browser i did the test the javascript is enabled, but it seems to run only after i pres the F12, runn

相关标签:
1条回答
  • 2021-01-04 14:35

    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 讨论(0)
提交回复
热议问题