Pop up on exit
Javascript popup window code generator
https://www.htmlbasix.com/generator/javascript-popup-window-generator
<!-- Javascript popup window courtesy of HTML Basix - www.htmlbasix.com -->
<script>
<!--
var popupWindow = null;
function popup(mypage,myname,w,h,pos,infocus, settings){
if (pos == 'random'){
LeftPosition = (screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
}
else{
LeftPosition = (screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
}
var windowsettings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',' + settings;
popupWindow=window.open(mypage, myname, windowsettings);
if(infocus=='front'){popupWindow.focus()} // Note, not all browsers will honour blur and focus!
if(infocus=='back'){popupWindow.blur();}
}
window.addEventListener("beforeunload", function (e) {
popup('https://photos.bravenet.com/292/091/931/5/4C9C0D1AB2.jpg', 'PopupJohn', '2000px', '1500px', 'center', 'front', 'scrollbars=no,resizable=no,menubar=no,toolbar=no,status=no,fullscreen=yes');
});
// -->
</script>
<!-- End Javascript popup window -->