fix(iframe-page): iframe cors (#1312)

Co-authored-by: EkkoLee98 <ekkoli@addcn.com>
This commit is contained in:
EkkoLee
2025-02-11 17:30:08 +08:00
committed by GitHub
parent a13b8c6e71
commit 2135106b8a

View File

@@ -27,7 +27,13 @@ onBeforeUnmount(() => {
async function releaseIframeResources() {
// Clear iframe content
currentUrl.value = 'about:blank'
iframeRef.value?.contentWindow?.document.write('')
/**
* eg: When use 'iframeRef.value?.contentWindow?.document' of t.bilibili.com iframe on bilibili.com, there may be cross domain issues
* set the src to 'about:blank' to avoid this issue, it also can release the memory
*/
if (iframeRef.value) {
iframeRef.value.src = 'about:blank'
}
await nextTick()
iframeRef.value?.contentWindow?.close()