I have added 4 JavaScript files to my page:
<script src="scripts/jquery/jquery-1.6.2.min.js"></script>
<script src="scripts/jquery/jquery.mobile-1.0b2.min.js"></script>
<script src="scripts/config.js"></script>
<script src="scripts/test.js"></script>
Google Chrome lists the first two files under scripts but not the last two. If I add the folloing JavaScript to the test.js
the alert happens:
alert('test');
How can I make chrome pick up the file to debug?
In the Developer Tools the last two scripts are not showing up. How can I make them show up?
To open the developer console in Google Chrome, open the Chrome Menu in the upper-right-hand corner of the browser window and select More Tools > Developer Tools. You can also use Option + ⌘ + J (on macOS), or Shift + CTRL + J (on Windows/Linux).
On Windows they live at C:\Users\<user-name>\AppData\Local\Google\Chrome\User Data\Default\Code Cache\Js, while on macOS they're at ~/Library/Caches/Google/Chrome/Default/Cache/Js.
There's a powerful tool hiding in your browser: Inspect Element. Right-click on any webpage, click Inspect, and you'll see the innards of that site: its source code, the images and CSS that form its design, the fonts and icons it uses, the Javascript code that powers animations, and more.
Your scripts probably get completely collected (by GC) before debugger has a chance to see them. I guess there are no global functions in these scripts.
If I'm right, you can try to put something simple like "function A111() {}" and check that the scripts are there now.
I would check the resources tab in dev tools and see if they are there under scripts.
also include type just to be safe
<script type="text/javascript" src="script.js"></script>
do you have a live example (link)?
I had this problem and the reason was: there was a JavaScript syntax error in the script and so that script didn't load in.
If you do have a syntax error, simply go to the Console tab in Developer Tools and look for any red lines e.g. "Uncaught SyntaxError: Unexpected identifier". On the right hand side is a link to the filename and line number so Chrome will tell you EXACTLY where your problem is.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With