in reply to Searching large files before browser timeout

One way to avoid the timeout would be to immediately send a results page to the browser. We cheat a bit. First generate a unique temporary page temp12345.htm where we will write our results when they become available. Next send a 307 Temporary Redirect header back to the browser that points to this temp12345.htm page. This temp page will then appear in the users browser window. Some text like:

We are processing your job, please click refresh
now and again to see it your job is complete!

will inform the user of what is happening.

You are then free to process the job. All you then need to do is write the result to your temp12345.html page and then when the user next presses refresh - voila the result. No timeouts. Until the results are written the user just gets the same please wait page with each refresh.

For elegance you could add a meta refresh to refresh the page every 10 seconds or whatever, then the user does not even need to worry about the refresh. When you write the result you dump the auto refresh so the final page does not keep reloading.

merlyn explains the whole thing in detail (and with code) here

Hope this helps

tachyon

  • Comment on Re: Searching large files before browser timeout

Replies are listed 'Best First'.
Re: Re: Searching large files before browser timeout
by John M. Dlugosz (Monsignor) on Jun 13, 2001 at 01:00 UTC
    You can specify a reload in the header ("client pull") rather than needing any client-side script.
      From experience, I would be wary of relying on browser refresh (whether manual or not). Web page caching occurs in so many hops between host and client, and varies in behaviour between - not only - browser type, but also browser version.

      Expect some visitors to experience unwanted behaviour from a setup like this. Unfortunately I know of no way to avoid it, other than not to rely on browser refresh.

      --
      Graq

      Agree. Getting tired. And Sloppy. Corrected. Thanks. tachyon

      sleep(28800);