Browse Source

Use `history.replaceState` on initial redirect

Eric Zhang 4 years ago
parent
commit
f19d11f555
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/useHash.ts

+ 1 - 1
src/useHash.ts

@@ -9,7 +9,7 @@ function getHash() {
     for (let i = 0; i < idLen; i++) {
       id += chars[Math.floor(Math.random() * chars.length)];
     }
-    window.location.hash = id;
+    window.history.replaceState(null, "", "#" + id);
   }
   return window.location.hash.slice(1);
 }