Skip to content

Commit 2491008

Browse files
committed
Handle referrer without protocol
1 parent 6e0cf02 commit 2491008

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
const attrRef = cur && cur.getAttribute('data-referrer');
2222
let base = window.location.origin;
2323
if (attrRef) {
24-
try { base = new URL(attrRef).origin; } catch {}
24+
// Support values missing protocol by resolving against window.location.origin
25+
try { base = new URL(attrRef, window.location.origin).origin; } catch {}
2526
}
2627
const referrer = base.endsWith('/') ? base : base + '/';
2728
window.polliLib.configure({ referrer });

0 commit comments

Comments
 (0)