|
Posted by Erwin Moller on 01/30/08 09:57
jodleren wrote:
> Hi all
>
> This is an idea of mine - a button will open this (using JS), which
> then should open a window with some information - then continue
> working. Idea - it may take some time, so this will process it, then
> store data and pass it on to the parent window.
> The idea works - only once done I get the onload - but I'd like to
> have the page visible already at the flush when doing things (the
> sleep as for now).
> This is an idea of mine, which I hope will come to work.
> Any ideas/ help ?
>
> WBR
> Sonnich
>
>
> <?php include("filehead.htm"); ?> // site header <head etc...
> <script type="text/javascript">
> function StartUp2()
> {
> if (window.opener && !window.opener.closed)
> {
> window.opener.document.forms[0].submit();
> window.opener.focus();
> }
> else
> alert("Parent window has been closed!");
> window.close();
> }
> </script>
> </head>
> <body onload="StartUp2();alert('done');">
> <?php
> echo "Searching for $searchfor, please wait...";
> echo "</body></html>";
> ob_flush();
>
> sleep(4); // I'd place something else here
> ?>
Hi Sonnich,
That approach is doomed to give you all kinds of headaches.
I tried a lot of such funky stuff, and expect you'll run into all kind
of problems, like I did.
For example:
1) outputbuffering might still buffer even if you ob_flush()
(IIS does this for PHP)
2) Some browser refuse to start displaying untill document is in.
(Or more subtle, they refuse to display content of eg a table, untill
they see the </table>)
Allthough I got some setups running and working, I always kept this
feeling: What will next version of IE/FF do? Or: Why does it work on
apache/nix, but not on IIS? Etc.
My advise is: Do not do it like that, even though you might get it up
and running in your development environment.
A much clearer way for you a programmer, and much more reliable way for
the end users, is using AJAX.
Since you rely on JavaScript anyway with your solution, AJAX should be
no objection.
EG, let JS poll every 5 seconds on the server asking if the task is
done, maybe saying which percentage is done in the meantime.
You don't even need a popup/popunder for that.
That way your solution will probably also work on next version of
IE/FF/webserver/etc.
Just my 2 cent.
Regards,
Erwin Moller
Navigation:
[Reply to this message]
|