Good Day All
i am opening a Popup and i want to bind the "onbeforeunload" to the popup that if someone clicks on the close button in the window or close button in the page , the event should fire a javascript function that is on the page that opened the popup.
function ProcessPayment(Downloadurl)
{
var url = "http://XXXX.com/cccc_ccccc/2938dc870cd394?tc_id=210&tc_45f=50.0&sig=fc5cbfe44230";
var popupWindow = window;
popupWindow.onbeforeunload = function () {
if (Downloadurl != "") {
$.fileDownload(Downloadurl)
.done(function () { alert('File download a success!'); })
.fail(function () { alert('File download failed!'); });
}
else {
alert("No URL found");
}
}
//open the Popup window
popupWindow.open(url, 'popUpWindow', 'height=400,width=500,left=10,top=10,resizable=no,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=yes')
//bind the event so that when a user close the windown , we download the file
when i try this nothing happens the event does not get work and no error in the browsers console
Thanks