Problem of user online/ offline status

Discussion in 'Javascript' started by Php Developer, Dec 19, 2007.

  1. 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.
     
    Php Developer, Dec 19, 2007
    #1
    1. Advertising

  2. Php Developer

    rf Guest

    "Php Developer" <> wrote in message
    news:...
    >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.

    --
    Richard.
     
    rf, Dec 19, 2007
    #2
    1. Advertising

  3. Hi,
    What i need some help to make it work if possible any ways pls tell
    Thanks
    > >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.
     
    Php Developer, Dec 19, 2007
    #3
  4. Php Developer

    Doug Miller Guest

    In article <>, Php Developer <> wrote:
    >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?

    > Thanks
    >> >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.
     
    Doug Miller, Dec 19, 2007
    #4
  5. Php Developer

    seani Guest

    On Dec 19, 12:41 pm, Php Developer <>
    wrote:
    > 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.
     
    seani, Dec 19, 2007
    #5
  6. 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
    On Dec 19, 6:53 pm, seani <> wrote:
    > On Dec 19, 12:41 pm, Php Developer <>
    > wrote:
    >
    > > 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.
     
    Php Developer, Dec 19, 2007
    #6
  7. 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



    On Dec 19, 6:50 pm, (Doug Miller) wrote:
    > In article <>, Php Developer <> wrote:
    >
    > >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?
    >
    >
    >
    > > Thanks
    > >> >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.- Hide quoted text -

    >
    > - Show quoted text -
     
    Php Developer, Dec 19, 2007
    #7
  8. On Dec 19, 2:02 pm, Php Developer <> wrote:
    > 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).
     
    David Dorward, Dec 19, 2007
    #8
  9. Php Developer

    Doug Gunnoe Guest

    On Dec 19, 8:02 am, Php Developer <> wrote:
    > 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
    >
    > On Dec 19, 6:50 pm, (Doug Miller) wrote:
    >
    >
    >
    > > In article <>, Php Developer <> wrote:

    >
    > > >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?

    >
    > > > Thanks
    > > >> >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.- Hide quoted text -

    >
    > > - Show quoted text -- Hide quoted text -

    >
    > - 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.
     
    Doug Gunnoe, Dec 19, 2007
    #9
  10. David Dorward wrote:
    > On Dec 19, 2:02 pm, Php Developer <> wrote:
    >> 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.


    Is it possible? -- Yes. Is it reliable? -- No.

    >> 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).


    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
    --
    "Use any version of Microsoft Frontpage to create your site. (This won't
    prevent people from viewing your source, but no one will want to steal it.)"
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
     
    Thomas 'PointedEars' Lahn, Dec 19, 2007
    #10
  11. Php Developer

    seani Guest


    > On Dec 19, 6:50 pm, (Doug Miller) wrote:
    >
    > > In article <>, Php Developer <> wrote:

    >
    > > >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?

    >
    > > > Thanks
    > > >> >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.- Hide quoted text -

    >
    > > - Show quoted text -


    On Dec 19, 2:02 pm, Php Developer <> wrote:
    > 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?
     
    seani, Dec 20, 2007
    #11
  12. Hi,

    "Php Developer" <> wrote in message
    news:...
    > 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
     
    Richard Maher, Dec 20, 2007
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernhard Hess
    Replies:
    0
    Views:
    793
    Bernhard Hess
    Feb 19, 2005
  2. mark
    Replies:
    0
    Views:
    110
  3. Esteban Yanson

    OnLine/OffLine transactions using SoapExtension

    Esteban Yanson, Apr 26, 2007, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    154
    Esteban Yanson
    Apr 26, 2007
  4. Savas Ates
    Replies:
    1
    Views:
    119
    Steven Burn
    Jul 31, 2004
  5. cjl
    Replies:
    6
    Views:
    131
Loading...

Share This Page