Skip to content

Commit 22b268f

Browse files
committed
fix(router): normalize URL base for script attributes
1 parent 1480587 commit 22b268f

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

packages/react-router/src/Asset.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ function Script({
5151
if (attrs?.src) {
5252
const normSrc = (() => {
5353
try {
54-
return new URL(attrs.src, window.location.href).href
54+
const base = document.baseURI || window.location.href
55+
return new URL(attrs.src, base).href
5556
} catch {
5657
return attrs.src
5758
}

packages/solid-router/src/Asset.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ function Script({
4343
if (attrs?.src) {
4444
const normSrc = (() => {
4545
try {
46-
return new URL(attrs.src, window.location.href).href
46+
const base = document.baseURI || window.location.href
47+
return new URL(attrs.src, base).href
4748
} catch {
4849
return attrs.src
4950
}

0 commit comments

Comments
 (0)