|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I am looking for a script that can stop exit ads from popping during regular site navigation. I want the exit ads to pop when a user leaves the site, but not when they are navigating through out the site (they would be called pop ups or pop behinds at that point).
Please take a look at SearchTheWorld.com. If you look at the code you will see the script for the exit campaign: <script language="javascript" src="http://z1.adserver.com/w/cp.x;rid=1;tid=4;ev=1;dt=1;ac=51;c=436;"></script> You will also see an attribute in the body tag line: onUnload="CPxPop1();" I suppose this is to keep the exit from popping on entrance. The solution I'm looking for is to have one script (and one body tag attribute) on the page that will keep the exit ad from popping during regular site navigation/browsing/surfing but will pop the exit ad when the page is closed. Any direction would be greatly appreciated. --JCM |
|
|||
|
The way I do it is to execute a script using the onUnload variable to execute a script having a conditional statement that checks to see that a Javascript variable's value, Exit=true. To initialize it, in the <body> tag, I say onLoad="Exit=true;". Then at every anchor link on my page I include the statement, onClick="Exit=false;".
This way, if the browser back button or some other exit from my site occurs, the onUnload javascript will execute because the variable Exit will equal true. |
|
|||
|
Actually, lightning's idea is pretty cool. You could do it with a single function onload instead of changing each link.
Code:
function changeLinks() //call this in body onload
{
for(var i = 0; i <document.links.length; i++)
{
document.links[i].onclick = exitTrue;
}
}
function exitTrue()
{
Exit = true;
}
|
|
|||
|
HardCoded,
I have actually used Lightning's method many years ago on personal sites. Since I'm starting a publisher's resource program, I need a simple implementation. Yours looks interesting. I will play around with it to see if it works for my application. Thanks, --JCM |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |