Last active
June 15, 2023 14:05
-
-
Save coulterpeterson/d2108c8573d56130b88292861dec1846 to your computer and use it in GitHub Desktop.
Reload a Page One Time After 5 Seconds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
window.onload = function() { | |
setTimeout(function(){ | |
if(!window.location.hash) { | |
window.location = window.location + '#loaded'; | |
window.location.reload(); | |
} else { | |
document.querySelector('body').classList.add('reloaded'); | |
} | |
}, 5000); // Time to wait in milliseconds. Change as needed | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment