mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
fix(iframe-page): iframe cors (#1312)
Co-authored-by: EkkoLee98 <ekkoli@addcn.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user