WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox 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.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-01-2003, 09:04 AM
WebProWorld New Member
 

Join Date: Dec 2003
Location: Asheville, N.C.
Posts: 4
cacooke RepRank 0
Default pop-up on exit problem

I need some advice on an exit pop-up for a web-site that I am working on for a client. Here is the scenario. There is a POP-IN pop-up as I call it for when visitors enter the site. I need 2 POP-OUT pop-ups on exiting the site. One is a thank you for registering, the other is a reminder to register, if they didn't. All the PHP code for tracking registrations is set-up and working. My problem is this, using the onunload function, you get the exit pop-ups anytime u leave the index page or do a refresh etc. I need to only have the pop-up upon exiting the whole site...
I am using sessions in php to track whether the client has registered or not...
Does anyone have any advice or possible a full solution to this situation? I'm sure i'm not the only one out there that has run into this :)
I look forward to hearing from anyone,
Thank you very much,
CAC
Reply With Quote
  #2 (permalink)  
Old 12-01-2003, 04:06 PM
mysticlighthouse's Avatar
WebProWorld Pro
 

Join Date: Jul 2003
Location: Louisville, KY
Posts: 186
mysticlighthouse RepRank 0
Default pop-under

http://www.katsueydesignworks.com/CGI_delayed_popup.htm

The preceding script throws a popup but then shifts the focus back to the main. When you close the browser, there it is. Hope it is what you are looking for and that it helps.
__________________
Bryan DeNosky
Reply With Quote
  #3 (permalink)  
Old 12-02-2003, 02:14 AM
WebProWorld Member
 

Join Date: Sep 2003
Location: Honolulu, Hawaii
Posts: 45
starrwriter RepRank 0
Default

My advice is don't use automatic popup windows. They are so hated the majority of people use popup stoppers nowadays.
Reply With Quote
  #4 (permalink)  
Old 12-02-2003, 09:10 AM
mysticlighthouse's Avatar
WebProWorld Pro
 

Join Date: Jul 2003
Location: Louisville, KY
Posts: 186
mysticlighthouse RepRank 0
Default The dreaded pop-up

I agree with you, starrwriter, that pop-ups are hated and blocked on a regular basis, but cacooke was just asking how he might be able to get the job done. From the sounds of it, the client is requiring the nasty little pop-ups.

Many large companies still use pop-ups and there are good uses for them. User requested pop-ups are very useful and valid. What people hate are the unrequested pop-ups. Sadly cacooke is needing them per a client request although you should never use unrequested pop-ups.
__________________
Bryan DeNosky
Reply With Quote
  #5 (permalink)  
Old 12-03-2003, 02:47 PM
WebProWorld New Member
 

Join Date: Dec 2003
Location: Asheville, N.C.
Posts: 4
cacooke RepRank 0
Default

Bryan,
Thanks for understanding. I have had that moral and ethical conversation with my client. He wants them anyway, and I am just building my client base, so I can't afford to lose him.

Your suggestion would work, excpet for 2 things:
1: the pop-up needs to appear not just when closing the browser, but when navigating AWAY from the site.
2: the content of the pop-up will be generated based on whether a customer registers/logs-in, so if they register or login they get a thank you, if they do not, they get a reminder. So to my knowledge, the pop-up needs to be generated at the time of exit, not entry...
Thanks
Reply With Quote
  #6 (permalink)  
Old 12-03-2003, 03:15 PM
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: Toronto, Canada
Posts: 2,193
cyanide RepRank 0
Default

Hi cacooke,

Welcome to WebProWorld !

The only solution I know of, means adding a code to all internal links so as to block(stop) the popup.

Like adding onClick="exit=false">
within the <a href tag
__________________
|
Web Hosting Guru
| Need Help For Your Forum?
Reply With Quote
  #7 (permalink)  
Old 12-03-2003, 03:16 PM
mysticlighthouse's Avatar
WebProWorld Pro
 

Join Date: Jul 2003
Location: Louisville, KY
Posts: 186
mysticlighthouse RepRank 0
Default A bit of a mess

From the sounds of it, you could do this...

Throw up the delayed pop-up with the survey in it. If they register/login then you can kill that one and have the thank you one take its place.

All the while the delayed pop-up can check to see if the parent differs from its root domain. If yes, then focus on the popup.

Let me know if that helps.
__________________
Bryan DeNosky
Reply With Quote
  #8 (permalink)  
Old 12-03-2003, 05:09 PM
WebProWorld New Member
 

Join Date: Dec 2003
Location: Asheville, N.C.
Posts: 4
cacooke RepRank 0
Default

Thank you cynaide and bryan.
Cyanide: A question for u would be "can a button have 2 onclick events, or 2 onclick events combined into 1, as some of the pages have buttons for links instead the href tag...Also, there would have to be some javascript to intercept and process the exit=false, correct? Could u show me a sample?

Bryan: I like ur Idea also, but as u can tell, i'm fairly new to javascript and php. I learn very quickly though and been programming professionally in other feilds since 1984... SOOO, is there any way I could talk u into showing me some snippets that may get me started? Spcifically, killing the original pop-up and most importantly, having the popup check if the parent differs from the root domain...

Thank you both VERY much for all ur patience and assistance...
CAC
Reply With Quote
  #9 (permalink)  
Old 12-03-2003, 05:13 PM
mysticlighthouse's Avatar
WebProWorld Pro
 

Join Date: Jul 2003
Location: Louisville, KY
Posts: 186
mysticlighthouse RepRank 0
Default This is how you put it all together

For the body tag for all of your pages with exception to your popup you would have:
Code:
<body onUnload="window.open('popup.html')">
In the head tag for popup.html you would have this script:
Code:
<script language="javascript" type="text/javascript">
		function check() {
			if(opener.location.href.indexOf("http://www.yoursite.com") < 0) {
				self.focus();
			} else {
				self.close();
			}
		}
	</script>
And the body tag for popup.html would call function check from the onLoad

Notice that the first line of the function is looking for the indexOf whatever your site is. I used yoursite.com... change it as appropriately needed.
__________________
Bryan DeNosky
Reply With Quote
Reply

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



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

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


Search Engine Optimization by vBSEO 3.2.0