From: Ardis Lu Date: Fri, 30 Sep 2022 05:20:57 +0000 (-0700) Subject: Simplify window.location references X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=b683df09ffe31c2f58b3be92e9f1b3a9d1625ef7;p=minimal-routing Simplify window.location references --- diff --git a/index.html b/index.html index 7d733ac..cf56544 100644 --- a/index.html +++ b/index.html @@ -140,7 +140,7 @@ if (!match) { // MUST redirect to a page where the web server serves an actual 404 error (i.e. not just // index.html again) otherwise this triggers an infinite loop - window.location.href = `${window.location.protocol}//${window.location.host}/errors/NotFound`; + window.location.href = `${window.location.origin}/errors/NotFound`; } } @@ -151,7 +151,7 @@ return; } - const base = new URL(`${window.location.protocol}//${window.location.host}`); + const base = new URL(`${window.location.origin}`); const url = new URL(path, base); window.history.pushState({}, '', url);