From 7589f679bea5db741c26ece2d07971fc2e1b0d7a Mon Sep 17 00:00:00 2001 From: superwf Date: Fri, 2 Dec 2016 14:16:03 +0800 Subject: [PATCH] Fix ie scroll in protocal file:// hash change [IE scroll change hash make wrong url](https://github.com/GitbookIO/theme-default/issues/38) My env is win7, ie11. It should be an ie bug, other browsers work good. I just remove the disk part of uri before history.replaceState use it. --- src/js/theme/navigation.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/theme/navigation.js b/src/js/theme/navigation.js index f1ff54f2..83af395d 100644 --- a/src/js/theme/navigation.js +++ b/src/js/theme/navigation.js @@ -130,6 +130,7 @@ function setChapterActive($chapter, hash) { uri = window.location.pathname + hash; if (uri != oldUri) { + uri = uri.replace(/(\/[A-Z]:)+/, ''); history.replaceState({ path: uri }, null, uri); } }