diff --git a/manual_trading_hub/static/app.js b/manual_trading_hub/static/app.js index 943c418..28f61ab 100644 --- a/manual_trading_hub/static/app.js +++ b/manual_trading_hub/static/app.js @@ -29,18 +29,10 @@ } } - function delegateInstanceToParent(url, title, exchangeId, nextPath) { + /** 在 LocalNav 等父页 iframe 内:直接替换本 iframe 地址,避免 postMessage / 三层嵌套 */ + function openInstanceInParentFrame(url) { try { - window.parent.postMessage( - { - type: "hub:open-instance", - url, - title: title || "实例", - exchangeId: String(exchangeId), - nextPath: nextPath || "/", - }, - "*" - ); + window.location.assign(url); return true; } catch (_) { return false; @@ -71,8 +63,8 @@ const row = lastMonitorRows.find((x) => String(x.id) === String(exchangeId)); const title = row ? row.name : exchangeId; instanceFrameCtx = { exchangeId: String(exchangeId), nextPath: next, title }; - if (isHubEmbedded() && delegateInstanceToParent(url, title, exchangeId, next)) { - return; + if (isHubEmbedded()) { + if (openInstanceInParentFrame(url)) return; } openInstanceFrame(url, title); } catch (e) { diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index dbbf05b..b38f45b 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -120,6 +120,6 @@
- +