简体   繁体   中英

Why doesn't Chrome Developer Tools show all JavaScript files?

I have a project that uses a main JSP to include component JSPs. Each JSP has its own JS file that gets included via a script tag with corresponding url. When I open Chrome Developer tools to debug my JavaScript, it seems to only show top-level JS files.

I have tried inserting alert statements in my lower level JS to make sure the scripts are getting loaded properly, and they do indeed alert when the page is loaded. However, the JS files are not listed under the sources tab of Chrome Developer Tools.

Is this known/expected behavior, and is there a way to debug these files in Chrome?

I noticed that for whatever reason, Chrome does not detect javascript files within script tags of included JSP files. The solution for me was to move the script tags into the top level JSP. This will have Chrome detect the file and make debugging available for that code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM