I have an iframe embedded into the page. Iframe have a button, when clicked opens up some part of iframe into a new window. Tried this in following way-
var w = window.open(url);
w.onload = function() {
    console.log('loaded');
    w.onunload =  function () {
        console.log('unloaded');
    }
}
But the onload event is never fired because of which onunload event is also not fired. Any solutions ?