Thomas 'PointedEars' Lahn said:
Why would you need that, given that the UA has a progress display already?
Why are you transmitting message bodies this large in the first place?
I think that is because that is what is expected by the user. This is how
the things are in my field (bioinformatics). You submit a query (e.g.
protein sequence), then a complex algorithm on the server side does
something that takes a long time (e.g. BLAST search) and then the user gets
e.g. 100 results. The user (which includes me as well) expects one page
with all results, which you can search using ctrl-f or print out.
Cf one of the most popular examples of such search engines, the BLAST web
site
www.ncbi.nlm.nih.gov/blast/
Apart from that -- it is not even the size of the loaded HTML, it just
takes a long time to do the actual algorithm behind the scenes.
Reads like a really bad idea. The first approach would depend on JS/ES, DOM
and XHR support. The second approach would take infinite time in the worst
case as reloading always reloads the entire document from the start.
Interestingly, this is how many of the aforementioned websites work -- and
they seem to be quite popular. Not that it makes them correct, mind you.
However, I solved the problem exactly like you suggested:
Of course there is. You can put the `script' element within your `body'
element at your convenience, provided the result is still Valid markup.
And with strict feature testing you may even attempt to create and insert
elements then.
I did not know that you are guaranteed that the JavaScript gets executed
immediately as it is read by the browser (I thought you could run into
problems like the browser waiting until certain tags are closed etc.). But
it seems to work quite OK.
But again, I don't see the point of all of this. You should redesign your
application so that it outputs data in smaller chunks.
I am sure that this could be done somehow. However, I have not the
faintest idea how. I guess I could output the search results e.g. ten at a
time with small "next >" and "< prev" buttons, but that would only make
everyone angry: you would like to print out the whole thing or to be able
to search through the report for whatever interests you. And,
additionally, it would make my application stand out and have an exotic
behaviour.
You are not making much sense. Maybe you are only looking for a simple wait
message on form submit, something like what Bugzilla does. For example:
Nope. Sorry I appear to be a little confused, I am really more confident
with C and Perl. What I mean is: if I do it via automatic page reloading,
this is the way to do it (I know it works like that in several websites and
I have done it myself a few times):
1) the CGI that does the search receives the parameters, forks. One
process shows the "please wait" HTML and makes the page reload itself
automatically. The other part detaches itself and runs the search
program, producing some sockets / files / whatever for IPC.
2) when the CGI is called with a job id (by the reloading page), it does
an IPC / lookup of job-specific files to find out what is happening
with the running job. It either finds that the script is still running
and displays the status information (and forces the page to reload
again) or displays the final output.
For this, one needs to make more complex CGI. The way I did it now, it
works much simpler: every now and then the CGI sends out a JavaScript code
that updates the status message, and when it is finished, removes it. No
need to fork, detach, redirect stdin/stdout/stderr, doing IPC.
Cheers,
j.