[英]Javascript close event for an auth pop that will redirect and close the original popup before
我正在使用集成在我的 html (PHP) 中的第三方工具作為 IFrame 解決方案。 (制造商的推薦)。
<iframe id="theIframe" src="manufacture.com"> </ iframe>
建立一個彈出窗口並重定向到帶有登錄屏幕的新彈出窗口。 任何人都有想法,我如何從所有彈出窗口中捕獲所有事件。 我需要來自登錄屏幕或它們的關閉事件的參考。
我如何檢查或捕獲此事件。
Iframe 啟動的彈出窗口將被重定向到第二個彈出窗口(無論出於何種原因),並且不會將第二個彈出窗口綁定到 iframe 並且不會到達事件。
if (window.attachEvent) {
window.attachEvent("onmessage", receiveMessage);
} else {
console.log("event message added");
window.addEventListener("message", receiveMessage, false);
}
function receiveMessage(event) {
//capture the event for closing the second popup
console.log(event);
alert("User has closed the window in the iFrame");
//Close iFrame
var iframe = document.getElementById('theIframe');
iframe.parentNode.removeChild(iframe);
}
}
簡而言之,問題並不是真正的問題。
這個問題沒有解決辦法。 我將第二個 pop 的 url 直接集成到 iframe 中。 有時解決方案是如此接近。
有時它只是有助於重新思考問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.