|
|
||||||
|
||||||
| 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 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 |
|
||||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
||||
|
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 |
|
|||
|
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 |
|
||||
|
For the body tag for all of your pages with exception to your popup you would have:
Code:
<body onUnload="window.open('popup.html')">
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>
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 | |
|
|
|
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 |