4

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?

bdigregorio
  • 51
  • 1
  • 5
  • Take a llok into the resource tab of chrome developer tool, perhaps your JS files are not detcted as JS files? – guli Jan 28 '14 at 21:43
  • In your console, are you seeing a transfer-type warning? It may be that it is there just not under the scripts, check your other file types tabs in chrome sources. It's probably being transferred as an image or something – Charlie Jan 28 '14 at 22:42
  • I have noticed the same problem here, got a fix for it ? – Alucard Jun 03 '14 at 13:04
  • Yes Alucard I was able to solve it for my situation, and I've added the solution as an answer. – bdigregorio Jun 03 '14 at 17:47
  • related http://stackoverflow.com/questions/31862344 – hello_earth May 23 '17 at 14:35

1 Answers1

1

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.

bdigregorio
  • 51
  • 1
  • 5