SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Enthusiast Wouter's Avatar
    Join Date
    Jan 2002
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    connection check?

    Is there a way in JavaScript or in HTML to check if there is an active connection to the internet? .... If there is no connection the browser's connection window pops-up. I want to prevent this and do nothing !

    any way ??

    Thanks -- Wouter

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only way that javascript can impact the browser is if the browser loads an HTML page with the js in it. So, to do what you ask successfully, the browser's initial page would have to be a local file, that redirects the user to another homepage if an internect connection is present. Obviously, this will only work for you, or anyone that copies the local file to their machine AND set's it as their browser's homepage.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Enthusiast Wouter's Avatar
    Join Date
    Jan 2002
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wink

    for better understanding : Is there a function that can check an active internet connection?

    below some code for what I want to do. Thanks

    <script language="JavaScript">

    function internetconnection_onoff()
    {
    if(internetconnection_onoff == off)
    return false;

    return true;
    }

    </script>


    <form onsubmit="internetconnection_onoff()" method=post action="http://www.noname.com/mail_page.asp" name="formname">
    <textarea rows=10 style="width:150" name=body_val>
    </form>


    <form>
    <input type="button" value="Send" onclick= "javascript:formname.submit();">
    </form>

  4. #4
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can create an xmlhttp object in javascript, post something and wait for response
    http://msdn.microsoft.com/library/de...quest_8bp0.asp

    Or you could have an applet in the page and try to connect to some resource... maybe

    How to get data from applet to javascript?
    See this thread

  5. #5
    SitePoint Enthusiast Wouter's Avatar
    Join Date
    Jan 2002
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    Thanks for the solution but there's one more problem:

    I do not control the server-side. I'm using a remote hosted service from a third party.

    Greetings -- still in need


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •