Why does JavaScript only work after opening Developer Tools?

Why does JavaScript only work after opening Developer Tools?

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 your console calls will then work.

Which browser Dev Tool tab will you use to run JavaScript?

The JavaScript debugger

  1. Firefox: Select ➤ Web Developer ➤ Debugger or press Ctrl + Shift + S to open the JavaScript Debugger.
  2. Chrome: Open the Developer tools and then select the Sources tab.
  3. Edge and Internet Explorer 11: Press F12 and then, Ctrl + 3 , or if the tools are already displayed, click on the Debugger tab.

How do I know if DevTools is open?

answer re: Detect if console/devtools is open in all browsers. If you are willing to accept an interference for the user you could use the debugger statement, as it is available in all major browsers.

Why does JavaScript only work after opening developer tools in IE once?

The experience you’re describing is typical of code which contain console.log () or any of the other console functionality. 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.

Why does JavaScript only work after JavaScript is run?

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.

How to make JavaScript work when console is not open?

When the console is not open, IE does pretty aggressive caching, so make sure that any $.ajax calls or XMLHttpRequest calls have caching set to false. $.ajax ( {cache: false.})

Why does JavaScript not work in F12 mode?

It means if your site or page has a caching problem (if it caches more than it should for example – that was my case), you will not see that problem in F12 mode. So if the javascript does some cached AJAX requests, they may not work as expected in normal mode, and work fine in F12 mode.