• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

Pop-up when user leaves domain

Hello,

Is there an easy way to find out when user leaves my domain? I have looked around and havent found an easy way... CNNSI.com and FORTUNE.com use javascript to do it but is very complicated. I need to pop-up a page when a user leaves my domain (not the page).

Thanks!
0
junglenative
Asked:
junglenative
  • 4
  • 3
  • 2
  • +1
1 Solution
 
lil_puffballCommented:
Is this what you're looking for?

<body onunLoad="window.open('url', config='height=#,width=#')";>

replace url with the url of the page you want to show in the popup, and the 2 #s with the height and width of the popup.
0
 
neongrauCommented:
hi!

this is a tricky one. but i have an idea...

put your whole site into a frameset consinsting of 2 frames. one of them has a height of 0px so its invisible to the user. put a page into this invisible frame with an unload event that opens your popup.

when you're navigating insider your domain you won't leave the frameset and no event gets triggered. but if the user closes the window or types a new url manually... voila!

~neongrau
0
 
junglenativeAuthor Commented:
Thanks for your answers,

lil_pufball - That works, but I want it only to work when the user leaves the domain (my site) and not every page.

neongrau - I have tried that, and it works. But I have no way of knowing where my visitors come to (I dont have one landing page). I can put a check on every page to see if its in a frameset and if not then put it in one... but it gets pretty messy.

Is there any way of knowing where the user is going from the page?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
neongrauCommented:
sorry no, i don't think theres any way to get that information.

that't the reason why i took the frameset approach. even IE's special extension won't provide that information.

~neongrau
0
 
junglenativeAuthor Commented:
I know that there is a way though... if you go to CNNSI.com or FORTUNE.com, the popup works. It only pops up when you leave the domain, or close the browser. They have a cookie set so it only works once, you might have to clear cookies to recreate.

Thanks again for your help.
0
 
junglenativeAuthor Commented:
I know that there is a way though... if you go to CNNSI.com or FORTUNE.com, the popup works. It only pops up when you leave the domain, or close the browser. They have a cookie set so it only works once, you might have to clear cookies to recreate.

Thanks again for your help.
0
 
lil_puffballCommented:
oh, is that what you meant? so sorry, i misunderstood! ;)

Well, what I'd suggest is use my code above, but on each of your pages place code so if there is a popup then you close it. this will get you the effect you want.
0
 
junglenativeAuthor Commented:
Thanks again lil_puffball,

The problem with that is the pop-up always pops up and then closes with every page. It gets annoying after a few of those. The only place I want the pop-up is at the check-out page (if they bail out). And I want it only to work if they go to some other domain or close the browser. The only thing I cant get to work is if they hit the back button. I can even get it to work if they click on any links on the page (I can put a flag with every link). SO the only problem I have is with the "back" button.
0
 
lil_puffballCommented:
So what code are you using right now so that it works on everything except the 'back' button?
0
 
jaysolomonCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: lil_puffball {http:#8037417}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jAy
EE Cleanup Volunteer
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now