Skip to content

How to debug dynamic Javascript’s in Chrome

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:

dynamic_scripts_in_chrome

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

dynamic_scripts_in_edge

marcd View All

I love to write software. More then two decades ago I managed to make my hobby my full-time job so I spent more then 20 year writing professional software (I guess that makes me a "Senior Software Developer"). The last few years I spend most of the time developing in C#/.Net for all kind of windows-, web- and embedded-software.

In my free time I enjoy my family, taking photos and go diving in cold lakes and rivers in Switzerland.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: