Reputation: 4154
In Chrome this seems to be easy, in the source tree, you see al scripts, including those loaded by iframes, so you can open them and set debug breakpoints. In Safari inspector although, in the Resources tab, the tree only shows resources loaded on the top window. I know the console has a dropdown to evaluate an expression on the context of an iframe, but I need to debug using breakpoints, is there a way to do that in Safari?
Upvotes: 1
Views: 1276
Reputation: 17703
You can replace the questionable JS file from prod with a local copy using Fiddler (windows) or Charles (mac). These tools can be configured to serve the local copy when the browser requests the remote copy.
This allows you to modify or debug JS from any domain - even if you do not own the code. Adding your debugger to the local file should trigger the debugger console.
Fiddler: check out this write up for Fiddler details: stackoverflow.com/a/3936627/1861459
Charles: use the Map Files feature of Charles: http://www.charlesproxy.com/documentation/tools/map-local/
Upvotes: 1