Dynamically loaded javascript not showing in source panel?

For example, I have an ajax request and it returns <script src='buggy.js'></script> .

The problem is that it does not appear in the source or resource panel. This means that I can’t do all the cool stuff like adding a breakpoint and checking items when they start.

I could see only the source of the js file under the "Network" panel.

Can I add chrome to the source panel? Or how are you guys going to debug dynamically added scripts?

Using Canary.

+8
google-chrome-devtools
source share
2 answers

I had the same problem and found a workaround that is better than a deliberate exception. It still requires changing the code, not just setting a breakpoint in the chrome dev tools.

I tried using "// # sourceURL = dynamicScript.js", which was suggested as an OP workaround, but it still didn’t show up for me if it didn’t already exist on my tabs from the previous time it threw the exception.

debugging coding; the line made him break in this place. Then, when it was in my tabs in the Sources panel, I could set breakpoints as usual and delete the "debugger"; line.

+2
source share

All Articles