From 277d8c8ad99b5efc9359dcaf8abd2108979d9fdf Mon Sep 17 00:00:00 2001 From: velzie Date: Tue, 3 Sep 2024 10:44:28 -0400 Subject: [PATCH] more base jank --- src/client/client.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/client.ts b/src/client/client.ts index 16503e5..c09b492 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -120,7 +120,11 @@ export class ScramjetClient { if (iswindow) { const base = client.global.document.querySelector("base"); if (base) { - return new URL(base.getAttribute(`href`), client.url.origin); + let url = base.getAttribute(`href`); + let frag = url.indexOf("#"); + url = url.substring(0, frag === -1 ? undefined : frag); + if (!url) return client.url; + return new URL(url, client.url.origin); } } return client.url;