Skip to content

Instantly share code, notes, and snippets.

@rcherny
Forked from carcinocron/debugger pause beforeunload
Last active March 27, 2021 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcherny/f7a0939ec8663a5c47dd2cd6a0908f67 to your computer and use it in GitHub Desktop.
Save rcherny/f7a0939ec8663a5c47dd2cd6a0908f67 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".
function createPause() {
console.log('debugger breakpoint applied to beforeunload;');
return function() { debugger; }
}
window.addEventListener("beforeunload", createPause(), false);
@rcherny
Copy link
Author

rcherny commented Mar 27, 2021

can't/shouldn't/rely on beforeunload etc. these days

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