Skip to content

Commit

Permalink
Access window only when available
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed Sep 23, 2024
1 parent df1db7f commit c5b87a1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pages/v2/[linkId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,12 @@ const Nettest = ({
}: Props) => {
const intl = useIntl()
const isIOS =
JSON.parse(userAgent)?.os?.family === 'iOS' &&
window?.location?.hostname !== 'run.test.ooni.org' //TODO: remove after iOS testing

typeof window !== 'undefined' // TODO: remove after iOS testing
? JSON.parse(userAgent)?.os?.family === 'iOS' && // TODO: remove after iOS testing
window.location.hostname !== 'run.test.ooni.org' // TODO: remove after iOS testing
: JSON.parse(userAgent)?.os?.family === 'iOS'
const displayDeepLink = isIOS ? iOSDeepLink : deepLink

console.log('isIOS', isIOS)
const windowScript = `window.onload = function() {
document.getElementById('l').src = '${displayDeepLink}';
setTimeout(function() {
Expand Down

0 comments on commit c5b87a1

Please sign in to comment.