Detecting presence of Internet connection

Discussion in 'Javascript' started by Peter Flynn, Oct 27, 2005.

  1. Peter Flynn

    Peter Flynn Guest

    I'm having trouble finding example code to detect the presence of
    an Internet connection. It doesn't seem to be a very frequently
    asked question, as all I need is the answer yes or no (is the user
    connected or not). I'm not interested in speed detection or any
    other aspect of the connection, just its existence or not. The
    reason is to be able to intercept link clicks on a CD-based set
    of HTML pages and pop up a warning if there is no connection;
    otherwise pass the request through to the net.

    ///Peter
     
    Peter Flynn, Oct 27, 2005
    #1
    1. Advertising

  2. Peter Flynn

    Ivan Marsh Guest

    On Thu, 27 Oct 2005 22:38:47 +0100, Peter Flynn wrote:

    > I'm having trouble finding example code to detect the presence of an
    > Internet connection. It doesn't seem to be a very frequently asked
    > question, as all I need is the answer yes or no (is the user connected
    > or not). I'm not interested in speed detection or any other aspect of
    > the connection, just its existence or not. The reason is to be able to
    > intercept link clicks on a CD-based set of HTML pages and pop up a
    > warning if there is no connection; otherwise pass the request through to
    > the net.


    How would you intend to determine between having an IP address on a LAN
    and having a connection on to the internet without pinging an address on
    the internet?

    The easiest way is to ask the user: Do you have a connection to the
    internet?

    --
    The U.S. Government today announced that it is changing its emblem from an
    Eagle to a CONDOM because it more accurately reflects the government's
    political stance... A condom allows for inflation, halts production, destroys
    the next generation, protects a bunch of pricks, and gives you a sense of
    security while you're being screwed.
     
    Ivan Marsh, Oct 27, 2005
    #2
    1. Advertising

  3. Peter Flynn

    Peter Flynn Guest

    Ivan Marsh wrote:

    > On Thu, 27 Oct 2005 22:38:47 +0100, Peter Flynn wrote:
    >
    >> I'm having trouble finding example code to detect the presence of an
    >> Internet connection. It doesn't seem to be a very frequently asked
    >> question, as all I need is the answer yes or no (is the user connected
    >> or not). I'm not interested in speed detection or any other aspect of
    >> the connection, just its existence or not. The reason is to be able to
    >> intercept link clicks on a CD-based set of HTML pages and pop up a
    >> warning if there is no connection; otherwise pass the request through to
    >> the net.

    >
    > How would you intend to determine between having an IP address on a LAN
    > and having a connection on to the internet without pinging an address on
    > the internet?


    For the specific application the users involved either have Internet
    access or they are offline completely (eg using a laptop out of range
    of wireless, phone, etc), so the state of being on the LAN but without
    Internet access won't arise (fortunately).

    > The easiest way is to ask the user: Do you have a connection to the
    > internet?


    The publisher is against this...

    ///Peter
     
    Peter Flynn, Oct 27, 2005
    #3
  4. Peter Flynn

    RobG Guest

    Peter Flynn wrote:
    > I'm having trouble finding example code to detect the presence of
    > an Internet connection. It doesn't seem to be a very frequently
    > asked question, as all I need is the answer yes or no (is the user
    > connected or not). I'm not interested in speed detection or any
    > other aspect of the connection, just its existence or not. The
    > reason is to be able to intercept link clicks on a CD-based set
    > of HTML pages and pop up a warning if there is no connection;
    > otherwise pass the request through to the net.
    >
    > ///Peter


    I think your real requirement is to detect if a particular resource is
    avaialble or not - whether the user has access to the internet or not
    is moot. Access to the URI could be blocked for any number of reasons
    unrelated to general internet access. Resources may be in different
    domains; some local, others not.

    There are detailed instruction at the link below, with code, to detect
    whether the user can access a particular URI. Create a 'can my
    function access this URI' function based on the code provided and you
    will have a much more robust function that doesn't care about how or
    whether the user is connected to internet:

    <URL:http://www.xml.com/pub/a/2005/02/09/xml-http-request.html>


    --
    Rob
     
    RobG, Oct 28, 2005
    #4
    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. a_srivathsan
    Replies:
    2
    Views:
    3,456
    a_srivathsan
    Sep 8, 2004
  2. Elizabeth Harmon

    Detecting Internet Connection?

    Elizabeth Harmon, Nov 21, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    1,440
    Elizabeth Harmon
    Nov 23, 2003
  3. |{evin

    MSN Presence info?

    |{evin, Jan 27, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    421
    |{evin
    Jan 28, 2004
  4. =?Utf-8?B?S2lt?=

    Check presence of Session State

    =?Utf-8?B?S2lt?=, Jan 2, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    437
    Eliyahu Goldin
    Jan 2, 2006
  5. Ramon
    Replies:
    0
    Views:
    314
    Ramon
    Dec 23, 2004
Loading...

Share This Page