client page status

Discussion in 'Javascript' started by trpost@gmail.com, Apr 3, 2006.

  1. Guest

    I want to create a small app where a client goes to a website, and from
    that page they can click a button and see what predefined URL's are
    reachable by them. If a URL is unreachable or down, then I want to
    return a message to the client with the http error code. I was able to
    create a server side application that does this from the servers
    perspective using php, but I now want to get the clients perspective.
    Any ideas on how to do this, or any reference to some code on where
    this has been done.

    Thanks!
    , Apr 3, 2006
    #1
    1. Advertising

  2. RobG Guest

    said on 04/04/2006 7:10 AM AEST:
    > I want to create a small app where a client goes to a website, and from
    > that page they can click a button and see what predefined URL's are
    > reachable by them. If a URL is unreachable or down, then I want to
    > return a message to the client with the http error code. I was able to
    > create a server side application that does this from the servers
    > perspective using php, but I now want to get the clients perspective.
    > Any ideas on how to do this, or any reference to some code on where
    > this has been done.


    From tha group FAQ:

    <URL:http://www.jibbering.com/FAQ/#FAQ4_34>

    which leads to:

    <URL:http://jibbering.com/2002/4/httprequest.html>


    --
    Rob
    Group FAQ: <URL:http://www.jibbering.com/FAQ>
    RobG, Apr 4, 2006
    #2
    1. Advertising

  3. Guest

    Thanks! Here is how I implemented it for future reference...

    <html>
    <head>
    <script type="text/javascript">
    var xmlhttp

    function loadXMLDoc(url)
    {
    // code for Mozilla, etc.
    if (window.XMLHttpRequest)
    {
    xmlhttp=new XMLHttpRequest()
    xmlhttp.onreadystatechange=state_Change
    xmlhttp.open("GET",url,true)
    xmlhttp.send(null)
    }
    // code for IE
    else if (window.ActiveXObject)
    {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
    if (xmlhttp)
    {
    xmlhttp.onreadystatechange=state_Change
    xmlhttp.open("GET",url,true)
    document.getElementById('A1').innerHTML=url
    xmlhttp.send()
    }
    }
    }

    function state_Change()
    {
    // if xmlhttp shows "loaded"
    if (xmlhttp.readyState==4)
    {
    clearPreloadPage();
    document.getElementById('A2').innerHTML=xmlhttp.status
    document.getElementById('A3').innerHTML=xmlhttp.statusText
    }
    }

    </script>
    </head>

    <body onload="loadXMLDoc('http://www.google.com:8080');">
    <p>

    <b>URL:</b>
    <span id="A1"></span>

    <br><b>status:</b>
    <span id="A2"></span>

    <br><b>status text:</b>
    <span id="A3"></span>
    </p>

    </body>
    </html>
    , Apr 4, 2006
    #3
    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. saha
    Replies:
    0
    Views:
    4,035
  2. Shug
    Replies:
    13
    Views:
    888
    Philipp
    Dec 15, 2006
  3. Shug
    Replies:
    13
    Views:
    940
    Philipp
    Dec 15, 2006
  4. harryos
    Replies:
    0
    Views:
    372
    harryos
    Oct 13, 2010
  5. Sven S.

    status info like rc.status

    Sven S., Dec 9, 2008, in forum: Ruby
    Replies:
    2
    Views:
    168
    Sven S.
    Dec 11, 2008
Loading...

Share This Page