473,326 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

close window and logout

Hello

I have my web application written in php and javascript.
When logged user clicks link logout he will be logout.
But when he closes tab or browser he is not logged in.

How can i do automaticaly some action when user closes tab or whole browser
to automatically log him out ?

Thanx
Jan 3 '07 #1
5 5151
How can i do automaticaly some action when user closes tab or whole browser
to automatically log him out ?
http://developer.mozilla.org/en/docs/DOM:window.onclose

google solves everything

Jan 3 '07 #2

http://developer.mozilla.org/en/docs/DOM:window.onclose
but it's only for gecko engine, will it work on IE ? :(

Thanx
Jan 3 '07 #3

avlee napísal(a):
http://developer.mozilla.org/en/docs/DOM:window.onclose

but it's only for gecko engine, will it work on IE ? :(

Thanx
i dont know, but there must be an alternative

Jan 3 '07 #4
here>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
<script language="javascript">

function haha()
{
alert("this one happens with closing window")
}

</script>
</head>
<body onUnload="haha();">
<a href="http://www.google.com">google</a>
</body>
</html>

this one works in firefox && msie. but there still is a problem, that
function runs even if you just change location

Jan 3 '07 #5
How can i do automaticaly some action when user closes tab or whole browser
to automatically log him out ?
If a regular session cookie is used (expire = "0"), the session should
expire when the whole browser is closed. Tabs are another matter,
surely depends on the browser.

An ugly method that should work: Have the browser keep the session
alive. Set a short garbage cllection time [1] for sessions on the
server (like a minute) and have the browser send in an XHR request
every 30s or so to touch the session on the server so it doesn't get
removed by the GC.

Steve

[1] in PHP this is "session.gc_maxlifetime".

Jan 3 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Petter Harnes | last post by:
We have a solution where we want to control the number of users logged in at the same time. So when the user log in we check number of currentusers agains allowedusers and increment a...
2
by: Mark | last post by:
The session_end event in the global.asax doesn't seem to fire very often. Is there a reliable way to capture when a user (a specific session_id) closes their browser window aside from forcing them...
20
by: Harry | last post by:
My development environment is Framework 1.1, ASP.Net and IE 6.X. I have logout button in all the screens in the application. I am doing database activity when the user clicks on logout button....
3
by: Lord2702 | last post by:
Sat. Oct. 30, 2004 3:25 PM PT I want to detect, if user has close the browser, (after logging to my site), that user has closed the browser. How to achieve it ? I want to know this close action...
11
by: SanthuBalu | last post by:
Hi Friends, I have a problem for logout operation. whenever i close the browser of my application, I should indicate that the user has logged out without clicking the logout button.. I hav written a...
9
by: Nagesh | last post by:
Hi All, I have a requirement to handle the window(browser) close event. When a user tries to close the browser window , we have to prompt him whether he wants to close the window or not. If...
5
by: agarwalsunitadhn | last post by:
hi.... Currently i am working in a project where i have to maintain the time in between the user logged in. but i got a problem when the user close the application through browser window's close...
8
malav123
by: malav123 | last post by:
Hi, I am maintaning the status of users in database who are online... and also it makes false the status whenever user gets logout but my problem is that if user closes the window...
24
malav123
by: malav123 | last post by:
Hi, I want to implement such a functionality in my project that whenever user is login and if he closes the window without logout then he should be logout and i also wants...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.