Connecting Tech Pros Worldwide Forums | Help | Site Map

Determine online status?

Daniel Orner
Guest
 
Posts: n/a
#1: Jul 20 '05
Is it at all possible to use JavaScript to find out if someone's
online or not? E.g. to try and fetch a URL and figure out if it failed
or not? I'm trying to add some functionality to my primarily online
program to also work offline, but I'd need this sort of thing to make
it work well.

Thanks!

Vicomte De Valmont
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Determine online status?


Yes, I'm checking again at:
http://www.unitedscripters.com/hotvamps/browsers.html

in IE the navigator object has a property which might be yours:
navigator.onLine
it returns now true - it means that though I'm checking on my local hard
disk this file, actually, it detects my system is online...

If you load the page with NS6 we can find none at least inspecting and
selecting the porpeties and inspecitng a bit the wealth of data. yet, why
not checking if the url protocol is http:? That would posiviely say whether
the user is online, with a marginal error which is not too big (that is:
page loaded online, but disconnection made while reading it)
location.protocol=="http:"
or you can buold an hash array of valid protocols
myprots=[];
myprots["http:"]=1;
myprots["ftp:!]=1; //etc...

then
if(myprots[location.protocol]){/*is ARGUABLY still online*/}

testing it from the location bar by the "javascript:" 'protocol' it gave to
me: "javascript:" :-)))

Just an idea, maybe others have better solutions. Just an idea.
ciao
Alberto Vallini



"Daniel Orner" <cidolfas@rpgclassics.com> ha scritto nel messaggio
news:77dd287a.0310291009.18d7963c@posting.google.c om...[color=blue]
> Is it at all possible to use JavaScript to find out if someone's
> online or not? E.g. to try and fetch a URL and figure out if it failed
> or not? I'm trying to add some functionality to my primarily online
> program to also work offline, but I'd need this sort of thing to make
> it work well.
>
> Thanks![/color]


Daniel Orner
Guest
 
Posts: n/a
#3: Jul 20 '05

re: Determine online status?


I don't think that would quite work, because I'm more dealing with
seeing if a user is viewing a page from the cache (i.e. offline) or if
he's online. If he is viewing something from the cache, the protocol
will be exactly the same as if he wasn't, if my understanding is
correct.

Anyway... after further thought this might not be the best way of
doing things in any case... but if anyone has any other ideas I'd love
to hear them. 8-)

--Daniel

"Vicomte De Valmont" <NOSPAM@hotmail.com> wrote in message news:<bnpfnu$1ni$1@lacerta.tiscalinet.it>...[color=blue]
> Yes, I'm checking again at:
> http://www.unitedscripters.com/hotvamps/browsers.html
>
> in IE the navigator object has a property which might be yours:
> navigator.onLine
> it returns now true - it means that though I'm checking on my local hard
> disk this file, actually, it detects my system is online...
>
> If you load the page with NS6 we can find none at least inspecting and
> selecting the porpeties and inspecitng a bit the wealth of data. yet, why
> not checking if the url protocol is http:? That would posiviely say whether
> the user is online, with a marginal error which is not too big (that is:
> page loaded online, but disconnection made while reading it)
> location.protocol=="http:"
> or you can buold an hash array of valid protocols
> myprots=[];
> myprots["http:"]=1;
> myprots["ftp:!]=1; //etc...
>
> then
> if(myprots[location.protocol]){/*is ARGUABLY still online*/}
>
> testing it from the location bar by the "javascript:" 'protocol' it gave to
> me: "javascript:" :-)))
>
> Just an idea, maybe others have better solutions. Just an idea.
> ciao
> Alberto Vallini
>
>
>
> "Daniel Orner" <cidolfas@rpgclassics.com> ha scritto nel messaggio
> news:77dd287a.0310291009.18d7963c@posting.google.c om...[color=green]
> > Is it at all possible to use JavaScript to find out if someone's
> > online or not? E.g. to try and fetch a URL and figure out if it failed
> > or not? I'm trying to add some functionality to my primarily online
> > program to also work offline, but I'd need this sort of thing to make
> > it work well.
> >
> > Thanks![/color][/color]
Closed Thread


Similar JavaScript / Ajax / DHTML bytes