From c653bf3aff84c74a905c0cc875f5f506a7657e72 Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Fri, 16 Aug 2013 12:04:42 +0200 Subject: [PATCH] Set URL in history.replaceState/pushState When is present, history.replaceState and history.pushState behave inconsistent with relative URLs. http://code.google.com/p/chromium/issues/detail?id=274024 Contrary to what one expect, passing '' as the URL parameter to replaceState/pushState does not associate the currently active URL with the history entry, but a path relative to . To fix the issue, explicitly associate the current active URL with the history's state. --- web/pdf_history.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/web/pdf_history.js b/web/pdf_history.js index 7607770e1..461d745af 100644 --- a/web/pdf_history.js +++ b/web/pdf_history.js @@ -65,7 +65,8 @@ var PDFHistory = { // is opened in the web viewer. this.reInitialized = true; } - window.history.replaceState({ fingerprint: this.fingerprint }, ''); + window.history.replaceState({ fingerprint: this.fingerprint }, '', + document.URL); } var self = this; @@ -270,9 +271,9 @@ var PDFHistory = { } } if (overwrite || this.uid === 0) { - window.history.replaceState(this._stateObj(params), ''); + window.history.replaceState(this._stateObj(params), '', document.URL); } else { - window.history.pushState(this._stateObj(params), ''); + window.history.pushState(this._stateObj(params), '', document.URL); } this.currentUid = this.uid++; this.current = params;