Problem of user online/ offline status

P

Php Developer

I want to know how to check that user is online or offline status if
he close his browser with the help of <body onunload>.As it not work
well if is user change his page as that time it is too fired.I want
only to fire function if user closed browser.
 
R

rf

Php Developer said:
I want to know how to check that user is online or offline status if
he close his browser with the help of <body onunload>.As it not work
well if is user change his page as that time it is too fired.I want
only to fire function if user closed browser.

Er, what? Google grouper, figures.

In any case you can not reliably know when a viewer "stops" looking at your
page. onunload does not work - what if they simply pull the plug on their
computer or wander off down to the pub?

This is asked frequently. Google.
 
P

Php Developer

Hi,
What i need some help to make it work if possible any ways pls tell
Thanks
 
D

Doug Miller

Hi,
What i need some help to make it work if possible any ways pls tell

What part of 'you can not reliably know when a viewer stops looking at your
page' did you not understand?
 
S

seani

I want to know how to check that user is online or offline status if
he close his browser with the help of <body onunload>.As it not work
well if is user change his page as that time it is too fired.I want
only to fire function if user closed browser.

It is impossible to /reliably/ get this information in the way you
want it. But what you're asking for also seems illogical. The fact
that the user has browser away from your page is the *only* indicator
you have. And that isn't reliable - what if the process is killed, or
the connection is dropped by the ISP, or the user has more then one
browser instance at a time open? These conditions all subvert the
notion of being "online" or "offline" as far as your question goes.
 
P

Php Developer

Hi,
I know maybe i m not asking unreliable thing but i want a way to make
it work if you know better way thn that then tell.As orkut and
facebook are using this things..
Thanks
 
P

Php Developer

Hi,
I know maybe i m not asking unreliable thing but i want a way to make
it work if you know better way thn that then tell.As orkut and
facebook are using this things..
Thanks
 
D

David Dorward

I know maybe i m not asking unreliable thing but i want a way to make
it work

It isn't possible, as you've been told several times.
if you know better way thn that then tell.As orkut and
facebook are using this things..

Then they lie. The closest you can come is "The user access a page X
seconds ago, they might still be online" (and that involves something
on the server, which could be JavaScript, but probably isn't).
 
D

Doug Gunnoe

Hi,
I know maybe i m not asking unreliable thing but i want a way to make
it work if you know better way thn that then tell.As orkut and
facebook are using this things..
Thanks

- Show quoted text -

facebook is probably just checking that the person is logged in. If
logged in, then they say they're "online". They do this with cookies.
And they probably don't use javascript for this, but some server side
stuff (php, for example) like David mentioned.
 
T

Thomas 'PointedEars' Lahn

David said:
It isn't possible, as you've been told several times.

Is it possible? -- Yes. Is it reliable? -- No.
Then they lie. The closest you can come is "The user access a page X
seconds ago, they might still be online" (and that involves something
on the server, which could be JavaScript, but probably isn't).

If the application depended on XHR, XHR could also be used to determine
whether or not a request could be made to the same document resource. If
it threw an exception on an otherwise proper XHR::eek:pen() call, then one
could assume that the client was offline, and if it did not, that it was online.


PointedEars
 
S

seani

Hi,
I know maybe i m not asking unreliable thing but i want a way to make
it work if you know better way thn that then tell.As orkut and
facebook are using this things..
Thanks

Ok, let's try a different tack; *why* do you want to know if a user is
"online" or "offline", and *what* are you going to use that
information for?
 
R

Richard Maher

Hi,

Php Developer said:
I want to know how to check that user is online or offline status if
he close his browser with the help of <body onunload>.As it not work
well if is user change his page as that time it is too fired.I want
only to fire function if user closed browser.

Leaving reliability and cross-browser issues aside for a moment, Java
Applets (sometimes) give you start/stop and init/destroy event notification.

Could be worth a look?

Cheers Richard Maher
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top