 |

12-01-2003, 09:04 AM
|
|
WebProWorld New Member
|
|
Join Date: Dec 2003
Location: Asheville, N.C.
Posts: 4
|
|
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
|

12-01-2003, 04:06 PM
|
 |
WebProWorld Pro
|
|
Join Date: Jul 2003
Location: Louisville, KY
Posts: 186
|
|
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
|

12-02-2003, 02:14 AM
|
|
WebProWorld Member
|
|
Join Date: Sep 2003
Location: Honolulu, Hawaii
Posts: 45
|
|
My advice is don't use automatic popup windows. They are so hated the majority of people use popup stoppers nowadays.
|

12-02-2003, 09:10 AM
|
 |
WebProWorld Pro
|
|
Join Date: Jul 2003
Location: Louisville, KY
Posts: 186
|
|
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
|

12-03-2003, 02:47 PM
|
|
WebProWorld New Member
|
|
Join Date: Dec 2003
Location: Asheville, N.C.
Posts: 4
|
|
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
|

12-03-2003, 03:15 PM
|
|
WebProWorld 1,000+ Club
|
|
Join Date: Jul 2003
Location: Toronto, Canada
Posts: 2,193
|
|
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
|

12-03-2003, 03:16 PM
|
 |
WebProWorld Pro
|
|
Join Date: Jul 2003
Location: Louisville, KY
Posts: 186
|
|
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
|

12-03-2003, 05:09 PM
|
|
WebProWorld New Member
|
|
Join Date: Dec 2003
Location: Asheville, N.C.
Posts: 4
|
|
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
|

12-03-2003, 05:13 PM
|
 |
WebProWorld Pro
|
|
Join Date: Jul 2003
Location: Louisville, KY
Posts: 186
|
|
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
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|