refresh page without click sound

Discussion in 'ASP General' started by JJ, Jun 11, 2004.

  1. JJ

    JJ Guest

    Hi,
    I am writing a web chat facility in asp.
    The problem is that my chat screen has to refresh every 10 seconds to check
    for any new messages in the conversation, this causes a 'click' sound.
    How can you refresh a page with out a 'click' sound? I currently use the
    meta refresh method, but there must be a different way, as other html chat
    clients I have seen do not make the 'click' sound and do not appear to use
    the meta refresh method.
    Thanks
    JJ
     
    JJ, Jun 11, 2004
    #1
    1. Advertisements

  2. JJ

    dlbjr Guest

    Use JavaScript and XML HTTP to make a call back to the server and receive the newest data then just
    append the new data to the bottom of the text in the screen. Why refresh the whole page every time?

    'from dlbjr

    'Unambit from meager knowledge of inane others,engender uncharted sagacity.
     
    dlbjr, Jun 11, 2004
    #2
    1. Advertisements

  3. JJ

    JJ Guest

    Hi,
    Thanks for that...
    any urls which might explain how to do this?
    Thanks
    JJ
     
    JJ, Jun 11, 2004
    #3
  4. JJ

    dlbjr Guest

    <script language="javascript" >
    //Set how often to update
    var intsecods = 1;
    //Set the url to get data from
    var url = "http://www.mamma.com"

    var x=setInterval("update()",1000 * intsecods)

    function update() {
    var http = new ActiveXObject("Microsoft.XMLHTTP");
    try{
    http.Open("GET",url,false);
    http.send();
    if(http.readyState==4) {
    data1.innerHTML = http.ResponseText
    }
    }
    catch(e){
    if(e instanceof Error) {
    data1.innerHTML = "no connection";
    }
    }
    }
    </script>
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <div id="data1">
    </div>
    </body>
    </html>


    //from dlbjr

    //Unambit from meager knowledge of inane others,engender uncharted sagacity.
     
    dlbjr, Jun 12, 2004
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.