JavaScript Progress bar is timing out.

Discussion in 'Javascript' started by Fulgore, Sep 18, 2008.

  1. Fulgore

    Fulgore Guest

    I have been using some javascript code I found online to do a generic
    progress bar for a long time. Recently, IE7 has decided that it
    doesn't want to wait on it any more. It now waits about 1-2 minutes
    and then displays the generic "Webpage could not be displayed"
    message. Has something changed?

    Here is the code I have been using. It is posting to a ASP.NET page
    that I have verified is still running after IE7 gives up on it.

    ....[snip]...

    var ctr = 1;
    var ctrMax = 50; // how many is up to you-how long does your end
    page take?
    var intervalId;
    function Begin()
    {
    //set this page's window.location.href to the target page
    window.location.href = "<%= Request.QueryString("destPage")%>";
    // but make it wait while we do our progress...
    intervalId = window.setInterval("ctr=UpdateIndicator(ctr, ctrMax)",
    500);
    }
    function End() {
    // once the interval is cleared, we yield to the result page (which
    has been running)
    window.clearInterval(intervalId);
    }

    function UpdateIndicator(curCtr, ctrMaxIterations)
    {
    curCtr += 1;
    if (curCtr <= ctrMaxIterations) {
    indicator.style.width =curCtr*10 +"px";
    return curCtr;
    }
    else
    {
    indicator.style.width =0;
    return 1;
    }
    }
    </script>
    </HEAD>
    <body onload="Begin()" onunload="End()">

    ....[snip]...
     
    Fulgore, Sep 18, 2008
    #1
    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.