This commit is contained in:
董宏凯 committed 2026-08-14 12:57:04 +08:00
commit 500dab29ab
3 files changed
+57

No files matched your search

@@ -51,7 +51,15 @@ function collectThemePayload(): DeerFlowThemePayload {
function postThemeToFrame(frame: HTMLIFrameElement | null) {
if (!frame?.contentWindow) return;
const src = frame.getAttribute("src") || "";
if (!src) return;
const targetOrigin = new URL(src, window.location.href).origin;
try {
const currentUrl = frame.contentWindow.location.href;
if (!currentUrl || currentUrl === "about:blank") return;
if (new URL(currentUrl, window.location.href).origin !== targetOrigin) return;
} catch {
// Reading location throws once the iframe has reached the cross-origin backend.
}
frame.contentWindow.postMessage(collectThemePayload(), targetOrigin);
}