Home / Free JavaScripts / Windows, remotes, frames / Here

Cut & Paste FairWell window launcher (updated:98/10/19)
Credit: JavaScript Kit

I got the idea for the following script from a site I recently visited. When I left, a cute little window popped up, thanking me for visiting their site, and urging me to come back real soon. The window actually made an impact on me, surprisingly. Here is a script that does just that- pops up a small, toolbarless window as the surfer leaves the page. To avoid over-irritating your surfers, the script comes with the added feature of only popping up the first time the surfer enters and leaves the page; if he/she goes to CNN for a while, then returns and leaves again, the window is not displayed. (Try leaving this page the first time- a window will be displayed. Come back, then leave again- no window!). Note: Cookies are used to determine how many times a surfer has visited a page; therefore, only browsers with cookies enabled will benefit from this "anti-irritant" feature.

Example: Press "back" (the first time) to leave this page and see the script in action.


Step 1: Insert the following into the <head> section of your page (change the :

Step 2: Insert the following into the <body> tag itself, like this:

<body onunload="loadpopup()">

JavaScript Tools:
Site Info

CopyRight 1998-2014 JavaScript Kit. NO PART may be reproduced without author's permission.