Results 1 to 5 of 5

Thread: JavaScript Techies??

  1. #1

    Default JavaScript Techies??

    Yo all, some help needed...

    Wondering if it's possible to let a window load a pl or php script, then close the browser window, whenever the user click on the X button on the top right corner.

    The flow should be something like this,

    <script>
    function leave() {

    some functions to load "byebye.pl"
    }
    </script>
    </head>
    <body onUnload="leave()">

    or any other ways of doing it?


    A million thanks.


  2. #2
    Member
    Join Date
    Nov 2002
    Location
    Fernvale Road, Sengkang
    Posts
    395

    Default

    here's a simple script I use for my co. intranet (originally used for ASP page).

    <script>
    function leave() {
    window.open('byebyeTOGU.php','window_handle','widt h=50,height=50');
    }
    </script>
    </head>
    <body onUnload="leave()">


    This should pop up the file byebyeTOGU.php whenever the document window is closed or user navigates to another site.

    In the php file, you should do whatever you need to do in PHP script and call the javascript window.close() function when you are done, to close this popup window.

    not too sure how you will do that in PHP but this works in ASP.
    Olympus E-3 / E-500 / XA | Vivitar UWS
    Blog & Photos

  3. #3
    Member
    Join Date
    Apr 2002
    Location
    Sengkang
    Posts
    569

    Default

    You probably want something like this .... ?

    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function leave ()
    {
    window.open('index.html');
    }
    //-->
    </SCRIPT>
    <BODY OnUnload=leave();>
    </BODY>
    </HTML>

  4. #4

    Default

    Originally posted by petaflopz
    here's a simple script I use for my co. intranet (originally used for ASP page).

    <script>
    function leave() {
    window.open('byebyeTOGU.php','window_handle','widt h=50,height=50');
    }
    </script>
    </head>
    <body onUnload="leave()">


    This should pop up the file byebyeTOGU.php whenever the document window is closed or user navigates to another site.

    In the php file, you should do whatever you need to do in PHP script and call the javascript window.close() function when you are done, to close this popup window.

    not too sure how you will do that in PHP but this works in ASP.
    no difference between PHP and ASP as we're talking about pure javascript here

  5. #5

    Default



    Coolio! Thanks Guys, will try it when I'm back to office.


Bookmarks

Posting Permissions

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