Try/catch URL parsing of referrer (#4511)
parent
d9066a6beb
commit
bdeac28d74
|
@ -43,12 +43,19 @@ if (isWeb && typeof window !== 'undefined') {
|
||||||
refUrl = decodeURIComponent(params.get('ref_url') ?? '')
|
refUrl = decodeURIComponent(params.get('ref_url') ?? '')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWeb && typeof document !== 'undefined' && document != null) {
|
if (
|
||||||
const url = new URL(document.referrer)
|
isWeb &&
|
||||||
if (url.hostname !== 'bsky.app') {
|
typeof document !== 'undefined' &&
|
||||||
referrer = document.referrer
|
document != null &&
|
||||||
referrerHostname = url.hostname
|
document.referrer
|
||||||
}
|
) {
|
||||||
|
try {
|
||||||
|
const url = new URL(document.referrer)
|
||||||
|
if (url.hostname !== 'bsky.app') {
|
||||||
|
referrer = document.referrer
|
||||||
|
referrerHostname = url.hostname
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type {LogEvents}
|
export type {LogEvents}
|
||||||
|
|
Loading…
Reference in New Issue