How to make JavaScript files show up in the list under "Scripts" in Google Chrome?
I have added 4 JavaScript files to my page:
<script src="scripts/jquery/jqu开发者_如何学Goery-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?
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.
精彩评论