fix(iframe): handle URL origin check errors gracefully

- Add try-catch block to prevent errors during URL origin comparison
- Fallback to opening link in new tab if origin check fails
This commit is contained in:
Hakadao
2025-02-24 00:16:37 +08:00
parent da16f7ff51
commit 73ddd61648

View File

@@ -254,7 +254,13 @@ function openIframeDrawer(url: string) {
const currentUrl = new URL(location.href)
const destination = new URL(url)
if (!isSameOrigin(currentUrl, destination)) {
try {
if (!isSameOrigin(currentUrl, destination)) {
openLinkToNewTab(url)
return
}
}
catch {
openLinkToNewTab(url)
return
}