The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Script To Open An Exit Window When Someone Leaves Your Site.

Go down

Script To Open An Exit Window When Someone Leaves Your Site. Empty Script To Open An Exit Window When Someone Leaves Your Site.

Post by sweet_potato 16/9/2008, 05:40

script To Open An Exit Window When Someone Leaves Your Site.

Place the following script between the <HEAD> and </HEAD> tags:

Code:
<script language="javascript">
<!-- begin

var exit=true;
function exitwindow()
{
var url = 'URL/to/popup.html';
var win = 'toolbar=0,directories=0,menubar=0,scrollbars=0,
resizable=0,width=250,height=300';
if (exit)
open(url,'WindowName',win); }

// end -->
</script>
Add the following into your <BODY> tag:
onUnload="exitwindow()"
Your <BODY> tag should then look something like this:
<BODY bgcolor="#ffffff" text="#000000" onUnload="exitwindow()">
And add the following into all internal links where you DO NOT want the new window to open:
onclick="exit=false"

For example:
Code:
<A href="http://www.deadcity.youneed.us/" onclick="exit=false">Join Now</A>
result:
<A href="http://www.deadcity.youneed.us/" onclick="exit=false">Join Now</A>

Although the script above is designed specifically to create an exit pop-up, you can in fact quite easily turn a standard on-entry pop-up into an exit pop-up.
How?
Simply change the onLoad command in the <BODY> tag to onUnload. You will still have to insert the onclick="exit=false" code into the links you don't want to trigger the pop-up.


script To Pre-Load Your Exit Window
This code will load your exit window information into the browser at the same as the main page. This makes it appear much faster when triggered by the visitor leaving the page. Place the following below the <BODY> tag:

Code:
<iframe src="URL/to/popup.html" name="FunctionName" height="0" width="0" noresize></iframe>
sweet_potato
sweet_potato
Forumember

Female Posts : 359
Reputation : 0
Language : english
Location : Philippines

http://www.dcboard.tk/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum