Skip to content

Instantly share code, notes, and snippets.

@andrewchilds
Created November 1, 2017 19:47
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 andrewchilds/b2b47a0eb150da275c10d846540b36b7 to your computer and use it in GitHub Desktop.
Save andrewchilds/b2b47a0eb150da275c10d846540b36b7 to your computer and use it in GitHub Desktop.
How long does it take to stop JS execution during a location redirect?
for (var i = 0; i < 1000; i++) {
logAndRedirect(i);
}
window.location.href = window.location.href;
function logAndRedirect(i) {
setTimeout(function () {
window.console.log(i);
}, i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment