PHP popup on exit
Moderator: General Moderators
PHP popup on exit
Does anyone know of a way to use php instead of javascript to display a popup window on exit, a true exit and not just an unload or beforeunload?
Is there a way to keep the current window open, display the popup, when the user wants to exit?
The concept is to display a popup window with a discount coupon when someone exits the checkout, hopefully keeping them from leaving your site during checkout!
Is there a way to keep the current window open, display the popup, when the user wants to exit?
The concept is to display a popup window with a discount coupon when someone exits the checkout, hopefully keeping them from leaving your site during checkout!
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
to elaborate:
Code: Select all
SCRIPT LANGUAGE="JavaScript">
function openwin() {
window.open("coupon.html", "title", "toolbar=0,status=0,menubar=0,scrollbars=no,resizable=no,width=315,height=400");
}</SCRIPT>Code: Select all
<body bgcolor="000000" onUnload="openwin()">-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Oh cmon guys I LOVE pop-ups, especially the porn ones, you know they just pop up whwenever you start firefox and guess what YOUR MOM passing by and GUESS WHAT these, let's call em APTCDFH (wich means Awesome Pop-up That Come Directly From Hell), have features like SOUND and ANIMATION. It is really AWESOME. Please anyone who wants to make pop-up when I LEAVE a site is like woah dude,your are given a whole new meaning to APTCDFH. I just installed on my computer lately a programm that just randomly pop-up something on my computer. It's so cool.
That wouldn't work as intended because the onUnload function is also executed when the users browses from one page of the site to another, not just when they close the window!tim wrote:to elaborate:Code: Select all
SCRIPT LANGUAGE="JavaScript"> function openwin() { window.open("coupon.html", "title", "toolbar=0,status=0,menubar=0,scrollbars=no,resizable=no,width=315,height=400"); }</SCRIPT>
Code: Select all
<body bgcolor="000000" onUnload="openwin()">
To get the desired affect, you need to use frames!
I have described how to do this a few time on this forum, do a search.
mark
Far easier to have you site in frames.lostboy wrote:Well, you could adapt the JS to see what page the its going to is...ie capturing the url...then popup if url is not in your site or the closes the browser...
Draco, love the APTCDFH, trouble is I keep spitting on my co-workers trying to pronounce it...
One which is only something like 1px in height. Load a page into there with the onUnload function, then, load the rest of yor site into the other frame.
Result: pop-up window will only appear when closing the browser window!
Easy!!
Mark