From 0c7d1f8ace8563b97e7c51d8da498565004182d3 Mon Sep 17 00:00:00 2001 From: sunhao Date: Fri, 12 Sep 2025 15:21:23 +0800 Subject: [PATCH] * [misc] fix open app not work from old page sometimes. --- module/index/js/index.ui.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/module/index/js/index.ui.js b/module/index/js/index.ui.js index c00681d8ec..a3d156a443 100644 --- a/module/index/js/index.ui.js +++ b/module/index/js/index.ui.js @@ -168,9 +168,13 @@ function openApp(url, code, options) } else { - iframe.contentWindow.document.open(); - iframe.contentWindow.document.write(apps.frameContent.replace('window.defaultAppUrl = ""', `window.defaultAppUrl = "${url}"`)); - iframe.contentWindow.document.close(); + const writeToDoc = () => { + iframe.contentDocument.open(); + const html = apps.frameContent.replace('window.defaultAppUrl = ""', `window.defaultAppUrl = "${url}"`); + iframe.contentDocument.write(html); + iframe.contentDocument.close(); + }; + if(!iframe.contentDocument.body.children.length) setTimeout(() => writeToDoc(), 500); } iframe.onload = iframe.onreadystatechange = function(e) {