Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
  <head>
</head>
<body>
  <button id='openWindow' onclick="openWindow();">Open Window</button>
o
</body>
</html>
 
function openWindow() {
  var win = window.open('http://jsbin.com' ,'title');
          setTimeout( function() {
            win.onclose =  function() {
                alert("what");
              alert('I am the 3rd one.');
            };
            },0);
        
        
    }
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers