How is this done?

stmadeveloper

New member
Aug 30, 2007
1,687
36
0
Had someone ask me today how this page does this....... and I honestly have no clue since I didn't think it was possible.

AffiloJetpack - Official Site | Affilorama

Try and leave it and after you click the javascript prompt asking you if you are sure you want to leave it redirects you to another page... but not where you wanted to go.

(and for the newbs - don't buy crap like this)
 


The anchor tags on the page have an onClick event setting a var to true like so:

window.exitPopupShown=true

leaving the page any other way (non forcefully - i.e: closing a tab, browser window or pressing cancel) triggers the window.onbeforeunload event, which checks if window.exitPopupShown=true

if it is anything but true, the popup will show.

It doesn't work in Opera. Also, clicking the 'X' in upper right of the popup will not trigger it.

Anytime they add a link to the page, they will have to set the onClick event accordingly, or it will show that popup.
 
Replace
javascript:eek:penit ('popup.html')
with javascript message box code, add onclick events at the bottom.

<SCRIPT LANGUAGE = "JavaScript">
<!-- //
function openit(sURL){newwindow=open(sURL,"newwin","width=300, height=300");
}
//-->
</script>
</head>
<body onUnload="javascript:eek:penit ('popup.html')">
Body Text.
</body>