1

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. 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.

Jaydeep
  • 1,686
  • 1
  • 16
  • 29
  • 1
    Possible duplicate of [Detect browser or tab closing](https://stackoverflow.com/questions/3888902/detect-browser-or-tab-closing) – bigwolk Apr 11 '18 at 10:55

1 Answers1

2

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);