]> git.openstreetmap.org Git - nominatim-ui.git/blobdiff - src/lib/stores.js
make sure webpages still work on file:// protocol (#94)
[nominatim-ui.git] / src / lib / stores.js
index 7ada7761489c0ddba2547c29f753f688cdc95f37..00b41959379e6b606c4b0a40040fb8bfb74f9d0d 100644 (file)
@@ -34,7 +34,13 @@ export function refresh_page(pagename, params) {
     if (param_str) {
       param_str = '?' + param_str;
     }
-    window.history.pushState([], '', pagename + '.html' + param_str);
+    let new_url = pagename + '.html' + param_str;
+
+    if (window.location.protocol.match(/^http/)) {
+      window.history.pushState([], '', new_url);
+    } else {
+      window.location.href = new_url;
+    }
   }
 
   page.set({ tab: pagename, params: params });