Skip to content

Commit

Permalink
Fix opening the customer portal link on Safari (#1737)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlago99 committed Sep 17, 2024
1 parent c2bb437 commit 3704927
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/pages/CustomerDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,20 @@ const CustomerDetails = () => {
// We open a window, add url then focus on different lines, in order to prevent browsers to block page opening
// It could be seen as unexpected popup as not immediatly done on user action
// https://stackoverflow.com/questions/2587677/avoid-browser-popup-blockers
const myWindow = window.open('', '_blank')

if (myWindow?.location?.href) {
myWindow.location.href = generateCustomerPortalUrl.url
return myWindow?.focus()
}

myWindow?.close()
addToast({
severity: 'danger',
translateKey: 'text_62b31e1f6a5b8b1b745ece48',
})
setTimeout(() => {
const myWindow = window.open('', '_blank')

if (myWindow?.location?.href) {
myWindow.location.href = generateCustomerPortalUrl.url
return myWindow?.focus()
}

myWindow?.close()
addToast({
severity: 'danger',
translateKey: 'text_62b31e1f6a5b8b1b745ece48',
})
}, 0)
}
},
})
Expand Down

0 comments on commit 3704927

Please sign in to comment.