JSFiddle - React, Tailwind, and code Playground

by lshettyl

HTML

<button type="button" onclick="return showWindow('popup.html')">bbb</button>

JavaScript

function showWindow(url){
    var newwindow=window.open(url,'name','height=300,width=350');
    newwindow.onload = function() {
        newwindow.onbeforeunload =  function () {
            alert("closed");
        };
    }
}