From a9724140530615f81f0eecddd34b5c938777dd4b Mon Sep 17 00:00:00 2001 From: PaulMaly Date: Wed, 19 Jun 2019 16:05:58 +0300 Subject: [PATCH 1/2] Listen `hashchange` if popstate = false Seems we should add an event listener to `hashchange` if `popstate` option equals false and `hashbang` option equals true. In this case, right now back navigation via `history.back()` not working. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 2fdbe101..ffd7f77c 100755 --- a/index.js +++ b/index.js @@ -81,7 +81,7 @@ _window.document.removeEventListener(clickEvent, this.clickHandler, false); } - if(this._hashbang && hasWindow && !hasHistory) { + if(this._hashbang && hasWindow && !this._popstate) { _window.addEventListener('hashchange', this._onpopstate, false); } else if(hasWindow) { _window.removeEventListener('hashchange', this._onpopstate, false); From 502db29c5f735533a4a7e5b9e1fe16a0f6318c42 Mon Sep 17 00:00:00 2001 From: PaulMaly Date: Wed, 19 Jun 2019 16:16:08 +0300 Subject: [PATCH 2/2] Leave !hasHistory check. Seems the previous condition should be left completely. Only additional behavior needed. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index ffd7f77c..10233b22 100755 --- a/index.js +++ b/index.js @@ -81,7 +81,7 @@ _window.document.removeEventListener(clickEvent, this.clickHandler, false); } - if(this._hashbang && hasWindow && !this._popstate) { + if(this._hashbang && hasWindow && (!hasHistory || !this._popstate)) { _window.addEventListener('hashchange', this._onpopstate, false); } else if(hasWindow) { _window.removeEventListener('hashchange', this._onpopstate, false);