浏览代码

Use `history.replaceState` on initial redirect

Eric Zhang 4 年之前
父节点
当前提交
f19d11f555
共有 1 个文件被更改,包括 1 次插入1 次删除
  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);
 }