[英]How to capture browser tab close event?
I have a link in my application on click of which new tab will get open. 单击我的应用程序中的链接,该链接会打开新选项卡。 I want to capture the event when newly opened tab will be closed to show some indication in my application.
当新打开的选项卡将关闭以在我的应用程序中显示一些指示时,我想捕获事件。 I am using Ext JS 3.4 version.
我正在使用Ext JS 3.4版本。 I have tried focus, blur and unload events but dint able to capture.
我尝试过聚焦,模糊和卸载事件,但能够捕捉。 Any hints will be really helpful.
任何提示将非常有帮助。
Note: I want to capture event on my application not on the new tab. 注意:我想在应用程序上捕获事件,而不是在新选项卡上。
You Can try this out.. 你可以试试看
var new_window = null;
function openWindow(url) {
new_window = window.open(url);
new_window.onbeforeunload = function(){
new_window.opener.postMessage('closed','*');
}
window.onmessage = function(event){
alert(event.data);
}
}
openWindow(url);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.