Skip to content

Instantly share code, notes, and snippets.

@carcinocron
Last active April 20, 2026 11:57
Show Gist options
  • Select an option

  • Save carcinocron/f6a509b84fe82a718816 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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

@Pysis868

Copy link
Copy Markdown

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
Copy Markdown

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

@maxploter

Copy link
Copy Markdown

Thanks!

@aghArdeshir

Copy link
Copy Markdown

Haha. Baahaal πŸ‘

@chenyong

Copy link
Copy Markdown

@StefanRudvin

Copy link
Copy Markdown

Thanks!

@OdedYaron

Copy link
Copy Markdown

so simple so genius!

@steffi-gruen

Copy link
Copy Markdown

Very helpful!

@landonbar

Copy link
Copy Markdown

!!

@TheReincarnator

Copy link
Copy Markdown

πŸ‘

@qwqVictor

Copy link
Copy Markdown

What a genius!

@dennisat

Copy link
Copy Markdown

Brilliant

@xiaokaike

Copy link
Copy Markdown

Brilliant

@przemek-nowicki

Copy link
Copy Markdown

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

@carcinocron

Copy link
Copy Markdown
Author

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

@BennyPolak

Copy link
Copy Markdown

Thanks! Saved the day!

@garronej

Copy link
Copy Markdown

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

@bigDP

bigDP commented Oct 16, 2020

Copy link
Copy Markdown

cool!

@ramphub

ramphub commented Jan 9, 2021

Copy link
Copy Markdown

Wow.. thanks!

@Mutefish0

Copy link
Copy Markdown

Thanks! Saved the day!

@vuhanguyen

Copy link
Copy Markdown

Awesome!!

@ot-johnny-davila

Copy link
Copy Markdown

thank you

@ducqhl

ducqhl commented Aug 29, 2021

Copy link
Copy Markdown

Thank a lot, man.

@4amparaboy

Copy link
Copy Markdown

Awesome

@chenxiaoyao6228

Copy link
Copy Markdown

Thank a lot, man.

@shinusuresh

Copy link
Copy Markdown

That's so nice

@jasonleow

Copy link
Copy Markdown

Saved my life! Thank you πŸ’ͺπŸ’ͺπŸ’ͺ

@snowman

snowman commented Mar 11, 2023

Copy link
Copy Markdown

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

jrt324 commented Mar 15, 2023

Copy link
Copy Markdown

greate idea

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