1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

You Are Now Leaving Site Script

Discussion in 'PHP & Perl' started by thefallendevelopment, Mar 28, 2009.

  1. thefallendevelopment

    thefallendevelopment Junior Member

    Joined:
    Aug 19, 2008
    Messages:
    170
    Likes Received:
    161
    Occupation:
    Crankin out sites
    Location:
    In the Caddy Shack
    So i've been searching the web and cannot seem to find a script or anything that does this.

    It's bascially like on mysp4ce when you click to goto another site off of mysp4ce it comes up with the "You are now leaving mysp4ce".

    Is there a WP plugin for this or anything of the sort?

    Thanks for any help!
     
  2. drdankmendez

    drdankmendez Junior Member

    Joined:
    May 30, 2008
    Messages:
    194
    Likes Received:
    316
    Location:
    In front of my computer
    This can be done with the javascript onunload event. Here is an example:

    Code:
    <html>
    <head>
    <meta content="text/html; charset=windows-1252" http-equiv=Content-Type>
    <script type="text/javascript">
    
    function checkLeave() {     
         alert("You Are Leaving ThisDomain.com");
    }
    
    </script>
    </head>
    <body onunload="checkLeave();">
    
    <a href="http://www.google.com/">Leave</a>
    
    </body>
    </html>