iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
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

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-03-2004, 12:31 PM
JCM JCM is offline
WebProWorld New Member
 
Join Date: Mar 2004
Location: Atlantic City
Posts: 3
JCM RepRank 0
Default Exit Code Help

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
Reply With Quote
  #2 (permalink)  
Old 05-03-2004, 06:56 PM
WebProWorld Member
 
Join Date: Oct 2003
Posts: 29
lightning RepRank 0
Default

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.
__________________
-Tony
_________________
Lightning Mortgage
Reply With Quote
  #3 (permalink)  
Old 05-03-2004, 07:16 PM
JCM JCM is offline
WebProWorld New Member
 
Join Date: Mar 2004
Location: Atlantic City
Posts: 3
JCM RepRank 0
Default

Tony,

I should have mentioned it.

I wanted a solution that didn't require adding a variable to every link on the page.

Thank you very much for responding.

--JCM
Reply With Quote
  #4 (permalink)  
Old 05-05-2004, 11:54 PM
WebProWorld Veteran
 
Join Date: Apr 2004
Posts: 447
HardCoded RepRank 0
Default

Good one. I don't suppose checking window.opener.closed in the pop-up would do what you want?
Reply With Quote
  #5 (permalink)  
Old 05-06-2004, 12:13 AM
WebProWorld Veteran
 
Join Date: Apr 2004
Posts: 447
HardCoded RepRank 0
Default

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;
}
You're basically setting an event handler on all links.
Reply With Quote
  #6 (permalink)  
Old 05-06-2004, 10:56 AM
JCM JCM is offline
WebProWorld New Member
 
Join Date: Mar 2004
Location: Atlantic City
Posts: 3
JCM RepRank 0
Default

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
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 01:28 AM.



Search Engine Optimization by vBSEO 3.3.0