Page is a not externally linkable
- WebmasterWorld
-- Webmaster General
---- Exit Poll


incrediBILL - 6:34 am on Feb 22, 2005 (gmt 0)


I dont know how to get an exit poll if they close the window, but I used to use something like this which should trap attempts to navigate to a new URLs, this little snippet may help assuming it still works in modern browsers.....

<script language="JavaScript">

var doPopup = true;

function onunloadPopup()
{
if (doPopup)
var aWin;
var url = "http://www.mydomain.com/exitsurvey.html";
aWin = window.open(url,ExitSurvey','width=300,height=400,screenX=50,screenY=50,left=25,top=25,scrollbars=0,resizable=1');
aWin.focus();
}
}
</script>

Add this to the BODY tag....

<body onUnload="onunloadPopup();">

Now to stop popups for internal site navigation you have to add the following to all form submits and links, probably a more elegant way to do this by checking the destination URL, but this is quick and dirty.

<form action="blah.html" method="post" onSubmit="doPopup=false;">

<a href="blah.html" onclick="doPopup=false;">


Thread source:: http://www.webmasterworld.com/webmaster/7913.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com