Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

HTML write and refresh issye "error file not found", work around?

  • 06-09-2009 1:43am
    #1
    Closed Accounts Posts: 7,221 ✭✭✭


    Hi, I have a particular issue that I am looking for a workaround.

    Here's the scenario ...

    A html file is written and ftp'ed every 15 seconds to my our web hosting from a template on a remote machine.

    The HTML file contains a refresh tag that refreshes the page every 15 seconds. This means that the visitor gets the latest information.

    Sooner rather than later, the page will refresh just as the newer version of the HTML file is being updated.

    The result is that you get a nasty white box saying "error file not found".

    Is there any work around this problem?
    Tagged:


Comments

  • Closed Accounts Posts: 228 ✭✭gnxx


    I would suggest that you use load a page that uses an XMLRequest object.

    Set a timer that reloads every 15 seconds and set a div.innerHTML to the updated data. Trap non 200 codes to avoid errors showing to the user. Maybe on error set the timer interval to 1 second .

    Here is some really rough code. Sorry its so bad but its a while since I've written Javascript ... it should however give you a good starting point.

    <head>
    <script>>
    onwindowload = load;

    load() {
    setTimeout("timer()",15000);
    }



    function timer() {
    var url = "http://myurl.com/update.html&quot; ;

    if (window.XMLHttpRequest) { // Non-IE browsers
    req = new XMLHttpRequest();
    req.onreadystatechange = paintdiv;
    try {
    req.open("GET", url, true);
    } catch (e) {
    alert(e);
    }
    req.send(null);
    } else if (window.ActiveXObject) { // IE
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if (req) {
    req.onreadystatechange = paintdiv;
    req.open("GET", url, true);
    req.send();

    }
    }

    // fire again in 15 secs
    setTimeout("timer()",15000);

    }

    function paintdiv() {
    if (req.readyState == 4) { // Complete
    if (req.status == 200) { // OK response
    document.getElementById("divXX").innerHTML = req.responseText;
    } else {
    // ignore error
    }
    }
    }

    </script>

    <head>

    <body>

    <div id="divXX">
    <!-- will contain dynamic content -->
    </div>





    BrianD wrote: »
    Hi, I have a particular issue that I am looking for a workaround.

    Here's the scenario ...

    A html file is written and ftp'ed every 15 seconds to my our web hosting from a template on a remote machine.

    The HTML file contains a refresh tag that refreshes the page every 15 seconds. This means that the visitor gets the latest information.

    Sooner rather than later, the page will refresh just as the newer version of the HTML file is being updated.

    The result is that you get a nasty white box saying "error file not found".

    Is there any work around this problem?


Advertisement