diff --git a/src/ui/hash.js b/src/ui/hash.js index 78202ae79bd..82d98153b51 100644 --- a/src/ui/hash.js +++ b/src/ui/hash.js @@ -132,9 +132,10 @@ class Hash { } _updateHashUnthrottled() { - const hash = this.getHashString(); + // Replace if already present, else append the updated hash string + const location = window.location.href.replace(/(#.+)?$/, this.getHashString()); try { - window.history.replaceState(window.history.state, '', hash); + window.history.replaceState(window.history.state, null, location); } catch (SecurityError) { // IE11 does not allow this if the page is within an iframe created // with iframe.contentWindow.document.write(...).