From: Nicolas Coden Date: Thu, 4 Jan 2018 08:12:13 +0000 (+0100) Subject: fix: prevent to loose query params when reseting hash in magellan X-Git-Tag: v6.6.0~3^2~324^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba938ce7b6ff8e41bf1eb7d7a9bcaba85eb30ea3;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: prevent to loose query params when reseting hash in magellan See: https://stackoverflow.com/a/5298684/4317384 --- 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{