?
Solved

Pop-up when user leaves domain

Posted on 2003-02-27
11
Medium Priority
?
221 Views
Last Modified: 2008-03-17
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
Comment
Question by:junglenative
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 12

Accepted Solution

by:
lil_puffball earned 300 total points
ID: 8037417
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
 
LVL 2

Expert Comment

by:neongrau
ID: 8037487
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
 

Author Comment

by:junglenative
ID: 8037645
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Expert Comment

by:neongrau
ID: 8037689
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
 

Author Comment

by:junglenative
ID: 8037712
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
 

Author Comment

by:junglenative
ID: 8037735
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
 
LVL 12

Expert Comment

by:lil_puffball
ID: 8038338
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
 

Author Comment

by:junglenative
ID: 8043343
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
 
LVL 12

Expert Comment

by:lil_puffball
ID: 8045437
So what code are you using right now so that it works on everything except the 'back' button?
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10096109
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

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question