www.webdeveloper.com
Results 1 to 2 of 2

Thread: Pop Up On Exit

  1. #1
    Join Date
    Oct 2006
    Posts
    1

    Unhappy Pop Up On Exit

    Hi does anyone know how to do a pop up on exit of site, whether they have closed the browser of typed in a new address, I've spent 2 days trying to find some code, thought I had it, placed it in 100 pages, then found out that it popped up even when you click on a link within the site, so page by page a new pop up would appear of the same thing.

    So I'm looking for some code that does all of the above but not open when the user is navigating through the site.

    Hope someone can help, I have to let you know I'm pretty new to this so please let me know where to place the code, head, body etc.

    I appreciate your time and knowledge.

    Thanks

  2. #2
    Join Date
    Jan 2005
    Posts
    3,067
    You can only do it when you navigate away from the page, not when they close the browser.:

    window.onunload=function(){
    window.open('http://www.google.com');
    }

    or

    window.onClose=function(){
    window.open('http://www.google.com');
    }

    Just place that between your script tags.
    Last edited by konithomimo; 10-16-2006 at 05:14 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles