fix(tracker): fix for weird shopify links

This commit is contained in:
nick-delirium 2023-02-09 17:08:45 +01:00
parent 08b21fab05
commit f7f8a7ac6a

View file

@ -5,14 +5,15 @@ import { hasTag } from '../app/guards.js'
function resolveURL(url: string, location: Location = document.location) {
url = url.trim()
if (url.startsWith('/')) {
return location.origin + url
} else if (
if (
url.startsWith('//') ||
url.startsWith('http://') ||
url.startsWith('https://') ||
url.startsWith('data:') // any other possible value here? https://bugzilla.mozilla.org/show_bug.cgi?id=1758035
) {
return url
} else if (url.startsWith('/')) {
return location.origin + url
} else {
return location.origin + location.pathname + url
}