Javascript break before Chrome's built-in javascript redirect

I am viewing a page with built-in javascript redirect ( window.location = "/anotherpage" ). I want to load the page in Chrome but disable the redirect line, so I can use this page without redirecting it.

Here is what I tried:

  • Developer Tools -> Cog -> General -> Disable JavaScript. Download page. It does not redirect (yay!). But I still want the rest of the javascript page to run, which is not the case.

  • Enter the URL and then click Developer Tools → Sources → Pause (F8) really fast! It is not redirected yet (yay!). Now I want to disable the redirect line before it pauses, but this part has not yet been loaded into the Developer Tools. So, I will start iterating over the javascript code of other files until I get there? But as soon as I exit other javascript files, it immediately redirects (doh!).

Can this be done? I thought it should be easy to disable the javascript string, but I'm at a dead end.

+76
redirect google-chrome-devtools
Sep 10 '12 at 22:14
source share
3 answers

Developer's tools → Sources → Event listener breakpoints (on the right side panel) → Download → check unload

This will cause the debugger to kill the unload event, which is dispatched before navigation.

+125
Sep 14
source share

Do the following

  • Open Developer Tools
  • Click the Sources tab.
  • Look for event listener breakpoints
  • Expand Download Parameter
  • Here you can choose the unloading option.

Breakpoint unloading storage

+34
May 18 '16 at 4:00
source share

I have a third-party JS library that had the wrong condition to reload the page. And the page was constantly reloading because of this. I tried to find where the wrong code is.

I tried to use the Event Receiver Breakpoints method, but the comment says that you do not have a stack trace in the unload events, so it is pretty useless.

Solution that worked for me: I created a page with an iframe tag with the sandbox attribute, for example, <iframe sandbox="allow-same-origin allow-scripts allow-popups allow-forms"></iframe> and placed my site in this . This way, security errors will occur in Chrome, and the console will show where JS is trying to access the location object. You can click on it and see the code. Best of all, Chrome has a JS decompressor (the {} button in the lower left corner of the source code window), which is smart, can show a line even after beautiful printing, so you can see it even in compressed JS.

Additional information on sandbox properties: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox

+7
Apr 14 '17 at 11:21 on
source share



All Articles