I'm trying to diagnose an issue with a web app that uses multiple Javascript files. One of the scripts modifies DOM by injecting a new element into it. My idea is that I would disable js files one by one until I find the one that causes the DOM modification. Is there a way in a browser to disable only certain js files? I would prefer a solution in Google Chrome (if its not possible then in Firefox or IE11)
Asked
Active
Viewed 2.0k times
17
-
2See http://stackoverflow.com/questions/9698059/disable-single-javascript-file-with-addon-or-extension – Anton Kovalenko Dec 23 '13 at 16:32
-
1Are you not able to simply comment out the files, or are you unable to edit the code? – Kelly J Andrews Dec 23 '13 at 16:40
-
I'm able to do both its just I was looking for a way to do error catching and code editing inside developer tools. That's the approach that experts seem to recommend – Dmitry Dec 23 '13 at 17:07
-
1Can't it be more simple to use [breakpoints on DOM mutation](https://developers.google.com/chrome-developer-tools/docs/javascript-debugging#breakpoints-mutation-events)? – Stan Dec 23 '13 at 19:17
-
Using fiddler 'AutoResponder', you can stop loading the a file itself. You can select the what kind of response need to be served to the browser in place of original content. Try 404 response for JS files one after the other. Good Luck !!! – Venkatesh Achanta Feb 24 '16 at 10:21
3 Answers
3
Try DOM Change Breakpoints. Whenever some JS modifies your DOM, you pause on the exact line of code that caused the change.
And yes, it is possible to disable JS files. See Block Requests. DevTools blocks the request for the JS file, therefore it never runs. Although in this particular situation, DOM Change Breakpoints will probably help you diagnose the problem faster.

Kayce Basques
- 23,849
- 11
- 86
- 120
-3
Probably you should use an external tool like fiddler, or use Browser Plugins. Firefox and Chrome both has plugins that can do this.

Tirtha
- 862
- 1
- 12
- 29