From ba938ce7b6ff8e41bf1eb7d7a9bcaba85eb30ea3 Mon Sep 17 00:00:00 2001 From: Nicolas Coden Date: Thu, 4 Jan 2018 09:12:13 +0100 Subject: [PATCH] fix: prevent to loose query params when reseting hash in magellan See: https://stackoverflow.com/a/5298684/4317384 --- js/foundation.magellan.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/foundation.magellan.js b/js/foundation.magellan.js index 42e7eaa17..5c0f06dd3 100644 --- a/js/foundation.magellan.js +++ b/js/foundation.magellan.js @@ -178,7 +178,10 @@ class Magellan extends Plugin { } if(hash !== window.location.hash) { if(window.history.pushState){ - var url = curIdx !== undefined ? hash : window.location.pathname; + // If there is no active idx, move to the same url without hash + // https://stackoverflow.com/a/5298684/4317384 + var url = curIdx !== undefined ? hash : window.location.pathname + window.location.search; + if(this.options.updateHistory){ window.history.pushState({}, '', url); }else{ -- 2.47.2