RE: [PHP] session_destroy problem
| From: | Larry Brown | Date: | Sat, 11 Jan 2003 06:10:10 +0000 |
| Subject: | RE: [PHP] session_destroy problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131232@lists.php.net to get a copy of this message | ||
You da man. Unload is perfect. If the problem he mentioned before prevents
the browser from finishing its communication with the server you can always
send a wait command with sufficient time for things to finish up. I'll
start testing in a live environment with it now. Thank you for the help.
Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388
-----Original Message-----
From: Tamás Árpád [mailto:sts@mail.xubion.hu]
Sent: Friday, January 10, 2003 8:03 PM
To: Larry Brown; Scott Fletcher; PHP List
Subject: Re: [PHP] session_destroy problem
> Yes, the JavaScript code can run before the browser is closed but it would
> not be finish running because the browser closing had been executed.
> Someone had tried it before and struggled with it. But that is a good
> advice, thanks for jumping in.
I really doubt that browsers doesn't run the code that is in unload event of
the page because the window is closed. That would be a very bad thing. Isn't
it what the unload event is for? I mean to run code when the page is
unloaded, it doesn't matter if the window is being closed or the user is
going to another page. I think the browser should finish all the opened
window's unload code and only after that close the application really.
I made a quick test for it:
<html>
<head>
<script language=javascript>
function wait(msec){
var enter_date = new Date();
var enter_time = enter_date.getTime();
var leave_date = new Date();
var leave_time = leave_date.getTime();
while (enter_time + msec > leave_time)
{
leave_date = new Date();
leave_time = leave_date.getTime();
}
alert('unload test');
}
</script>
</head>
<body onunload="wait(5000)">
unload test
</body>
</html
It works fine for me in ie6 and mozila 0.9.6, it shows the alert message
after about 5 seconds.
Arpi
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php