How do I make JavaScript files appear in the list in the Scripts section of Google Chrome?

4 JavaScript files have been added 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 the scripts, but not the last two. If I add the following JavaScript to test.js , a warning will occur:

 alert('test'); 

How can I get chrome to select a file for debugging?

In the developer tools, the last two scenarios are not displayed. How can I show them?

+6
source share
3 answers

Your scripts are likely to be fully assembled (GC) before the debugger can see them. I believe that in these scenarios there are no global functions.

If I'm right, you can try to do something simple, for example, "function A111 () {}", and check that there are scripts there.

+2
source

I would check the resource tab in dev tools and see if they are under scripts.

also include type to be safe

 <script type="text/javascript" src="script.js"></script> 

Do you have a live example (link)?

0
source

I had this problem and the reason was: there was a JavaScript syntax error in the script and therefore the script did not load in .

If you have a syntax error, just go to the Console tab in the Developer Tools and find all the red lines, for example. " Untrained SyntaxError: Unexpected identifier . On the right side is a link to the file name and line number, so Chrome will tell you EXACTLY where your problem is.

0
source

Source: https://habr.com/ru/post/896046/


All Articles