Created
June 12, 2021 08:20
-
-
Save ayamkv/48145c60e1ea7646c26d1589a9caf195 to your computer and use it in GitHub Desktop.
Simple ReplaceHistoryState
This file contains 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
function docReady(fn) { | |
// see if DOM is already available | |
if (document.readyState === "complete" || document.readyState === "interactive") { | |
// call on next available tick | |
setTimeout(fn, 1); | |
} else { | |
document.addEventListener("DOMContentLoaded", fn); | |
} | |
} | |
docReady(function() { | |
history.replaceState({}, null, "/") | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment