pg.
pg.

Reputation: 2531

I want to block window.location.href in a new tab in chrome

I have a link that opens in a new tab, in the new tab's header it has javascript like this which redirects it to a different page:

window.location.href = "{a different URL}";

I need to debug the new tab before it redirects in an incognito window. What can I do in chrome to stop the new tab from redirecting so that I can debug it? I can't take the redirect out because I need to debug it in a live environment to replicate an issue.

Upvotes: 2

Views: 2671

Answers (1)

coagmano
coagmano

Reputation: 5671

You can set a breakpoint for beforeunload in the source panel of the Chrome debugger:

Chrome debugger beforeunload event breakpoint location

This will fire when window.location changes

Upvotes: 2

Related Questions