I want to debug some javascript that comes from html that’s assembled at runtime by the application. What the app does is treat the “.html” file as something of a template with placeholders for runtime-generated content. While this should be done with a technology like JSP, this application already exists and I need to work on it.
So if I view the html and set a breakpoint on a javascript line inside a script element, I apparently never hit my breakpoint because the URL the client references doesn’t refer to the html file? Instead, my servlet programmatically accesses that file while delivering content to the client.
For example, let’s say I have an html file called my_app.html. My servlet is programmed to respond to a url like http://localhost:8080/myapp/home by opening my_app.html, plugging in some runtime content like the user’s name and streaming that to the client.
So apparently the javascript debugger has no way to relate the file with my breakpoint in it to the content the client browser received?
Do I need to externalize my JavaScript code into files that are separate from these html fragments? Or is there maybe a simpler strategy that doesn’t impact this existing application that much?
Thanks for your help.