473,386 Members | 1,710 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,386 software developers and data experts.

Determine online status?

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!
Jul 20 '05 #1
2 4319
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" <ci******@rpgclassics.com> ha scritto nel messaggio
news:77**************************@posting.google.c om...
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!

Jul 20 '05 #2
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" <NO****@hotmail.com> wrote in message news:<bn**********@lacerta.tiscalinet.it>...
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" <ci******@rpgclassics.com> ha scritto nel messaggio
news:77**************************@posting.google.c om...
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!

Jul 20 '05 #3

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

Similar topics

9
by: David | last post by:
I am setting up a web community with a feature that will display whether or not a member is currently online. I intend on implementing this by holding a column in the dbase simply called online....
2
by: OvErboRed | last post by:
Hi, I'm trying to determine whether a given URL exists. I'm new to Python but I think that urllib is the tool for the job. However, if I give it a non-existent file, it simply returns the 404 page....
7
by: Ross Presser | last post by:
OK, I've been researching this problem and can't find a definitive answer yet. The situation is one that seems to have come up a few times to different folks. I am writing an application that...
8
by: Gabe Moothart | last post by:
Hi, I'm writing a windows service which interacts with a separate process. Basically, it calls a process which creates a file, and then my service reads that file. The problem is, the external...
2
by: Chris Carter | last post by:
We have a site, for reference I'll call this MainSite, that has certain pages actually hosted on another site, I'll call this ChildSite. In MainSite when you click on a certain link, it loads a...
2
by: CK | last post by:
How do I determine the Num Lock status, on or off, and display it on a status bar? TIA
40
by: Jeff | last post by:
I have a system on a network and want to determine if anyone is currently connected to the back-end files. An interesting twist is that I have noticed that some users can be connected (have the...
7
by: semedao | last post by:
Hi all, I view many posts about this issue , the connected property does not tell us the current status of the socket. based on couple of suggestions of msdn , and some article here , I try to...
10
by: Mitul | last post by:
Hello everybody, I am developing a community site and almost all works are competed. There is major issue that I am facing is how to track user's online status. I am using session data to save...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.