Page 1 of 1

PHP popup on exit

Posted: Wed Jul 28, 2004 3:13 pm
by mattmcb
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!

Posted: Wed Jul 28, 2004 3:18 pm
by feyd
it'd all be controlled client-side, so I'm pretty sure there is no way to know exactly when they really leave the site.

Posted: Wed Jul 28, 2004 3:19 pm
by brandan
php is a markup scripting language that is interpreted by the server, not the client.

or it used to be.

Posted: Wed Jul 28, 2004 3:37 pm
by John Cartwright
or it used to be.
still is

Posted: Wed Jul 28, 2004 3:51 pm
by brandan
i added that in because i just didn't know.

Posted: Wed Jul 28, 2004 3:56 pm
by lostboy
you would need to use the js onUnload function to open an new window with the coupon...

Posted: Wed Jul 28, 2004 4:18 pm
by tim
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");
&#125;</SCRIPT>


Code: Select all

<body bgcolor="000000" onUnload="openwin()">

Posted: Wed Jul 28, 2004 7:29 pm
by kettle_drum
As i user i hate this kinda thing though. I leave a web page as i WANT to leave and dont want to be swamped with pop-ups..... i just want to leave the site. Just a word of warning.

Posted: Wed Jul 28, 2004 7:34 pm
by tim
i will agree 110% with above.

If I can get my mouse over to the close button fast enough, the pop-ups never load.

and if they do, i dont pay any attention to them.

Posted: Thu Jul 29, 2004 8:45 am
by Draco_03
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.

Posted: Thu Jul 29, 2004 8:49 am
by JayBird
tim wrote:to elaborate:

Code: Select all

SCRIPT LANGUAGE="JavaScript">
function openwin() &#123;
  window.open("coupon.html", "title", "toolbar=0,status=0,menubar=0,scrollbars=no,resizable=no,width=315,height=400");
&#125;</SCRIPT>


Code: Select all

<body bgcolor="000000" onUnload="openwin()">
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!

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

Posted: Thu Jul 29, 2004 8:54 am
by lostboy
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...:)

Posted: Thu Jul 29, 2004 9:04 am
by Draco_03
Hahahahaha...
yeah hehe it's quite impossible.. :P

Posted: Thu Jul 29, 2004 9:53 am
by JayBird
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...:)
Far easier to have you site in frames.

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

Posted: Thu Jul 29, 2004 9:58 am
by lostboy
I agree, I was just offering another framless option, thats all