marcduerst.com

How to debug dynamic JavaScripts in Chrome

Note: This post originally contained 2 images that could not be recovered during the WordPress migration.

If your app is loading HTML with Javascript in there using AJAX these dynamic scripts will not show up in Chrome script-debugger (nor Firefox). They show up in IE 11 and Edge but without name.

To be able to debug them you can name these scripts using a comment on the end of the script block:

//# sourceURL=PersonMassUpdateTab.js

Place this //# sourceURL=....js code just before the closing script tag.

After loading this content you’ll see the dynamic script in Chrome’s debugger like this:

Edge will show it too with name but IE doesn’t: