Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const removeLocationHash = () => {
  2.   const noHashURL = window.location.href.replace(/#.*$/, '');
  3.   window.history.replaceState('', document.title, noHashURL)
  4. }
  5.  
  6. window.addEventListener("popstate", (event) => {
  7.   event.preventDefault();
  8.   removeLocationHash();
  9. });
  10. window.addEventListener("hashchange", (event) => {
  11.   event.preventDefault();
  12.   removeLocationHash();
  13. });
  14. window.addEventListener("load", () => {
  15.   removeLocationHash();
  16. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement