Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const removeLocationHash = () => {
- const noHashURL = window.location.href.replace(/#.*$/, '');
- window.history.replaceState('', document.title, noHashURL)
- }
- window.addEventListener("popstate", (event) => {
- event.preventDefault();
- removeLocationHash();
- });
- window.addEventListener("hashchange", (event) => {
- event.preventDefault();
- removeLocationHash();
- });
- window.addEventListener("load", () => {
- removeLocationHash();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement