New Document (CGI)
[1/4] from: ammon:rcslv at: 24-Apr-2002 3:21
Hi, I am playing with some CGI.... I have a time consuming script that happens in the background & I want to let the user know something is happening, but when it is done I want to send the user a fresh page & get rid of the notification stuff. Has anyone here done anything similar? I appreciate your comments! Thanks!! Ammon
[2/4] from: cybarite:sympatico:ca at: 24-Apr-2002 11:57
Ammon, Not as pretty as you might want but you can use the html meta tag to refresh the page . browser sends request to CGI script ... say script is %long-running-thing.r . %long-running-thing.r sends page to browser with message about process in progress . this page includes <META HTTP-EQUIV="Refresh" CONTENT="10;URL=http://your.domain/monitor.r"> . %long-running-thing.r script sets semaphore to indicate process not done . %long-running-thing.r starts its work . after 10 seconds, the browser refresh sends a request to your %monitor.r to see if anything has finished . %monitor.r checks the semaphore . if done, then %monitor. r sends the final results to the browser . if not done, then %monitor.r returns the same (or another) in progress message to the browser . this refreshed page has to have a meta tag in it to refresh as the original message did . long-running-thing.r runs in background . when finished, it stores the results where they can be picked up by monitor.r and sent to the browser . when finished, it resets the semaphore to indicate that the process is done . for the semaphores, it can be whatever you need but writing a file named with the unique key to distinguish separate users seems to work . you can pass the key back on the url for the refresh e.g. <META HTTP-EQUIV="Refresh" CONTENT="10;URL=http://your.domain/monitor.r?key=123456789"> And, of course, the semaphore file can be the result file if %long-running.thing.r is written that way.
[3/4] from: g:santilli:tiscalinet:it at: 25-Apr-2002 11:28
Hi Ammon, On Wednesday, April 24, 2002, 12:21:58 PM, you wrote: AJ> I am playing with some CGI.... I have a time consuming script that happens AJ> in the background & I want to let the user know something is happening, but AJ> when it is done I want to send the user a fresh page & get rid of the AJ> notification stuff. Has anyone here done anything similar? It's not very popular, and I don't know how well it is supported across browsers, but you could use "server push". Basically you return your page as a special multipart MIME type (I think it was something like multipart/replace, I don't remember); you return the first part immediately with the "please wait" message; then you return the second part, and the browser uses it to replace the first one. You should be able to find more info on the net, maybe on the w3c site or in some RFC. HTH, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[4/4] from: petr::krenzelok::trz::cz at: 25-Apr-2002 13:00
Gabriele Santilli wrote:
>Hi Ammon, >On Wednesday, April 24, 2002, 12:21:58 PM, you wrote:
<<quoted lines omitted: 13>>>HTH, > Gabriele.
What about returning simply html containing some "Wait a moment ..." message, and also containing something like: <META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://www.your-url"> You can specify time, for which your browser should wait ... then it will try to reload the url. Now the only one thing you need is to generate unique id/handler, and pass it to the script, e.g. <META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://www.your-url.com/cgi-bin/some-script.cgi?handler=xyz123"> ... it would simply call some script, which could check if the file of appropriated id is available and if so, return its content back ... -pekr-
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted