Opening a popup window on Exit

How do you make a new automatically launched window that goes to a URL if the user exits from the site? You can achieve this effect by using the onUnload event, although we encourage you to use this script sparingly.

<SCRIPT LANGUAGE = "JavaScript">
 <!-- // 
 function openit(sURL){newwindow=open(sURL,"newwin","width=300, height=300");
 <body onUnload="javascript:openit ('smallwin.html')">
 body text goes here

You can also change the height and width settings, or add or remove other windows settings by adding the following functions:

function openit(sURL){newwindow=open(sURL,"newwin","scrollbars=no,toolbar=no,directories=no,menubar=no,resizabe=no,status=no,width=300,height=300");

pop-up window pop up window javascript on exit onUnload

Back To Top
© 1998 - 2024
Version 7.21 | Advertise on this site