No matter is browser close or the tab close.
i want detect exactly is close but not when transferring to another pages.
Now, i am success to open a new window with new web page, but the problem i faced is when user trying to go another pages, it will show the new window again.
P/S: i am using ASP.NET to develop my webpage and these code is put under the Master Page
$(document).ready(function() {
window.onbeforeunload = beforeUnload;
window.onunload = afterUnload;
});
function beforeUnload() {
return "You are attemped to leave the page. Are you sure want to leave MSJ Bank Financial?";
}
function afterUnload() {
params = 'width='+screen.width;
params += ', height='+screen.height;
params += ', top=0, left=0'
params += ', fullscreen=yes';
window.open('/Thanks.aspx', '_newtab', params);
window.focus();
}