Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript files not appearing in chrome developer tools

This happens periodically and has been for weeks. Most of the time everything's fine, but occasionally chrome simply doesn't show JS files. Visiting the same site via another URL or viewing in incognito can fix it. Restarting the server doesn't help. I'm pretty sure it's a problem with chrome (v43.0.2357.134 v44.0.2403.107, still happens). I'm using django's runserver, though not sure it's relevant since the html is fine, validates at w3c and I can go to the js URL and load it.

enter image description here

I'm not even sure how to start debugging something like this. Is it a known bug with chrome? Perhaps some flag/setting that's wrong?


UPDATE:

If I have the debugger open when I refresh I get no js. otherwise it's fine.

ANOTHER UPDATE:

Here's my file structure:

<!DOCTYPE html>
<html>
    <head>
        <script type="text/javascript" src="test.js" ></script>
    </head>
    <body>
    </body>
</html>

Here's the javascript in test.js.

alert("hi");

When I refresh this page (opened by double clicking the file) with the debugger open, alert doesn't run and the js file doesn't appear in the "Sources" tab. The same behaviour when inlining the js.

like image 706
jozxyqk Avatar asked Jul 26 '15 11:07

jozxyqk


2 Answers

uncheck "disable javascript" and everything works

Think this pretty much sums it up.

The Disable JavaScript option does not disable JS globally, but only when the dev tools are open on page load. Most of the time I was only bringing up the dev tools to check on a errors and inspect the page after it had loaded.

like image 186
jozxyqk Avatar answered Oct 03 '22 00:10

jozxyqk


If it ever worked then, go to F1 (i.e) setting of the developer tool. then select (restore detauls and reload.) All should be fine

like image 38
HUDI Jashyawanta Huidrom Avatar answered Oct 02 '22 22:10

HUDI Jashyawanta Huidrom