Skip to content

Instantly share code, notes, and snippets.

@carcinocron
Last active April 25, 2024 16:48
Show Gist options
  • Save carcinocron/f6a509b84fe82a718816 to your computer and use it in GitHub Desktop.
Save carcinocron/f6a509b84fe82a718816 to your computer and use it in GitHub Desktop.
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@Directory
Copy link

Im having a bit of trouble interacting with the website in this state. im trying to copy a string

@Pysis868
Copy link

Chrome has a UI in the DevTools Sources panel for Event Listener Breakpoints which has the various Load > * events like the one mentioned here. Not sure it's working though..

@ottokruse
Copy link

Cool. And where do you see what page it would be redirecting to then, had it not paused?

@Maxvgrad
Copy link

Thanks!

@aghArdeshir
Copy link

Haha. Baahaal 👍

@chenyong
Copy link

@StefanRudvin
Copy link

Thanks!

@OdedYaron
Copy link

so simple so genius!

@steffi-gruen
Copy link

Very helpful!

@landonbar
Copy link

!!

@TheReincarnator
Copy link

👍

@qwqVictor
Copy link

What a genius!

@dennisat
Copy link

Brilliant

@xiaokaike
Copy link

Brilliant

@przemek-nowicki
Copy link

You can also check Preserve Log checkbox in Network Settings (Chrome DevTools plugin)

@carcinocron
Copy link
Author

Actually the whole point of this is that the "Preserve Log" checkbox doesn't actually work...

@BennyPolak
Copy link

Thanks! Saved the day!

@garronej
Copy link

You are beautiful, don’t let anyone tell you otherwise!

@bigDP
Copy link

bigDP commented Oct 16, 2020

cool!

@ramphub
Copy link

ramphub commented Jan 9, 2021

Wow.. thanks!

@Mutefish0
Copy link

Thanks! Saved the day!

@vuhanguyen
Copy link

Awesome!!

@ot-johnny-davila
Copy link

thank you

@ducqhl
Copy link

ducqhl commented Aug 29, 2021

Thank a lot, man.

@4amparaboy
Copy link

Awesome

@chenxiaoyao6228
Copy link

Thank a lot, man.

@shinusuresh
Copy link

That's so nice

@jasonleow
Copy link

Saved my life! Thank you 💪💪💪

@snowman
Copy link

snowman commented Mar 11, 2023

bump, really save life, otherwise the original URL is lost when 302 auto redirected to page saying this region is not available, and there is not the history entry for original URL, neither switch back.

-- Edit
okay, I did not try it before I reply, what I saying here is not the feature to pause redirection automatically in the background, means you have to open devtools console beforehand to run the code first. Google leads me to here, but now it's time to go

@jrt324
Copy link

jrt324 commented Mar 15, 2023

greate idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment