🔒 Locked
[web] CGI Wait Screen?
Advertisement
Original Post
I was thinking of something where they click submit and then a new page pops up that says their request is being processed. It could take anywhere from 20 seconds to a day and so I think I might put in time estimates, but that would be preferable. What is a meta refresh? Thanks
Will the application finish writing the output before the submitted data has been processed? If so, output the intermediate page and set a refresh for 5-10 seconds (or however long you need) and keep outputting that page until the script detects that the submitted data has been processed. Otherwise, use DHTML/javascript to display the wait message and disable the form.
Check out here for a little info on either the http refresh or meta refresh: scroll down to client pull
http://wp.netscape.com/assist/net_sites/pushpull.html
You can also google for more info.
As far as how it integrates into you c++ cgi program, no differently then how you send any http headers or html text. You send it down the stream.
http://wp.netscape.com/assist/net_sites/pushpull.html
You can also google for more info.
As far as how it integrates into you c++ cgi program, no differently then how you send any http headers or html text. You send it down the stream.
Alright, this is enough to make me bash my head through a wall. I read that document (and many others) and I can't figure out why my program doesn't work. The problem is that instead of processing the data as multipart/mixed it is outputting at the top of my data:
--PageBorder
Content-Type: text/html
At the start I output:
Content-type: multipart/x-mixed-replace;boundary=PageBorder\n\n
Then:
--pageBorder\nContent-Type: text/html\n\n
Followed by my HTML data and ended by:
\n--PageBorder--\n
Now what on earth is wrong? Why is it sticking my pageborder into the output page? I am really stuck and getting frustrated. Thank you.
--PageBorder
Content-Type: text/html
At the start I output:
Content-type: multipart/x-mixed-replace;boundary=PageBorder\n\n
Then:
--pageBorder\nContent-Type: text/html\n\n
Followed by my HTML data and ended by:
\n--PageBorder--\n
Now what on earth is wrong? Why is it sticking my pageborder into the output page? I am really stuck and getting frustrated. Thank you.
Do this then, have your cgi write an entry to a file or database with the a user_id session with a flag of some sort that it is working and set a complete flag when done... Send the clients browser with a refresh rate of (depending on your average completion time) 5-10 (or more) seconds. But, also put a hidden form on the page with some kindof flag (such as task=check_status) or just have it go to status_check.cgi or whatever.
When the page gets refreshed, it will initiate a new cgi process app on your server, but the first thing this app does is check the flag in the database or file to see if the process is done, if not, resend refresh and try again. If it is do whatever else you were trying to do.
Sounds reasonable to me.
When the page gets refreshed, it will initiate a new cgi process app on your server, but the first thing this app does is check the flag in the database or file to see if the process is done, if not, resend refresh and try again. If it is do whatever else you were trying to do.
Sounds reasonable to me.
In the past, I've always just had a page that displays the 'loading...' message, and then immediately forwarded to the new, takes-ages-to-load page. As long as no actual data is sent by the server until the time-consuming bit is complete, most browsers seem to just wait while displaying the previous page (in this case, your loading page).
fractoid, I never thought of that, sounds like it would work prety good.
I just thought of another benifit in refreshing though, you could also modify my suggestion and have an entry in the data base for a percentage of work done, an a time count down based on that. This could be updated by the cgi script still working, and then cgi script that gets invoked during refresh would just read the database and update the screen with new info (such as a completion bar graph)
I just thought of another benifit in refreshing though, you could also modify my suggestion and have an entry in the data base for a percentage of work done, an a time count down based on that. This could be updated by the cgi script still working, and then cgi script that gets invoked during refresh would just read the database and update the screen with new info (such as a completion bar graph)
How about I do this:
Create a temporary html output file where I copy a generic waiting message. Forward the user to that temporary html file. That temporary html file refreshes every 15 seconds (or whatever). When my process is done, I open that temporary html file and replace it with my output data and then close the file.
Only one question, what if I open the file right when the client is trying to refresh? What would happen? Is it safe?
Create a temporary html output file where I copy a generic waiting message. Forward the user to that temporary html file. That temporary html file refreshes every 15 seconds (or whatever). When my process is done, I open that temporary html file and replace it with my output data and then close the file.
Only one question, what if I open the file right when the client is trying to refresh? What would happen? Is it safe?
Alright so I made it so that my program does the following:
Reads the waiting screen html file and copies it to a temporary HTML file.
It then forwards the user to the temporary HTML file.
The temporary HTML files meta-refresh with CONTENT set to 10.
At the end of the program execution, it overwrites the wait screen with the output.
The problem I'm having is that when I send Location:waiting.html\n\n, the browser keeps pausing until the entire program is complete. How do I tell it to close the connection and go to the waiting screen?
Thanks
Reads the waiting screen html file and copies it to a temporary HTML file.
It then forwards the user to the temporary HTML file.
The temporary HTML files meta-refresh with CONTENT set to 10.
At the end of the program execution, it overwrites the wait screen with the output.
The problem I'm having is that when I send Location:waiting.html\n\n, the browser keeps pausing until the entire program is complete. How do I tell it to close the connection and go to the waiting screen?
Thanks
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement