Skip to content

Instantly share code, notes, and snippets.

@colinlord
Created August 7, 2020 20:30
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 colinlord/89e5c041290f8d48c9395758ef5950fe to your computer and use it in GitHub Desktop.
Save colinlord/89e5c041290f8d48c9395758ef5950fe to your computer and use it in GitHub Desktop.
Fire JS after page is totally loaded
document.addEventListener("readystatechange", function () {
switch (document.readyState) {
case "complete":
{
// put your code here that will run after the page loads completely.
// if there is "flashing" and complaints are raised you can choose an earlier readyState
// always use "complete" if loading external resources
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment