Re: displaying text while page is loading

From: Dani CS (contusiones.merluza_at_yahoo.es.quita-la-merluza)
Date: 12/21/04


Date: Tue, 21 Dec 2004 21:43:49 +0100

Sacs wrote:
> yawnmoth wrote:
>
>> i'm trying to display text while a page is loading using a method
>> similar to the following:
>>
>> <?
>> ob_end_flush();
>> echo 'AAA<br>';
>> flush();
>> sleep(10);
>> echo 'BBB';
>> ?>
>>
>> in this script, AAA and BBB appear at the same time - when the page has
>> fully loaded - which is not what i want (i want AAA to appear and then
>> 10 seconds later, BBB to appear). pursuant to the suggestions on
>> php.net's entry for flush, i've also tried the following to no avail:
>>
>> <?
>> echo 'AAA<br>';
>> ob_flush();
>> flush();
>> sleep(10);
>> echo 'BBB';
>> ?>
>>
>> any help would be appreciated - thanks!
>>
> Errr, you cant. A browser-webserver connection is stateless. The
> browser will wait until the whole page has arrived before displaying it,
> at which stage the web server and your php have allready forgotten about
> you.

You are wrong. Counterexample available at
<http://www-etsi2.ugr.es/web/buscapersonas.php3>.

"stateless" means that the server is aware of the client only during the
request-response time, but the rest of the time the client is disconnected.

What the original post requests is a way to make the client update the
webpage in the middle of the response, when the connection is still
established and data is flowing from the server. This is perfectly
possible, if the browser is capable.

>
> You *may* be able to do something using a http refresh in the <head> of
> the page e.g.
>
> page1.php:
> echo '
> <head>
> <META HTTP-EQUIV=Refresh CONTENT="10; URL=http:page2.php">
> </head>
> <body>
> AAA<br>
> ';
>
> page2.php:
> echo 'BBB<br>';

I think that the original post doesn't want this.



Relevant Pages

  • Re: Show-stopper Exchange problem
    ... we want the display name to reflect the name of the ... With pretty much any regular old SMTP server, ... client running in smtp mode to set your display name on outbound email, ...
    (microsoft.public.windows.server.sbs)
  • Re: Pure client-side javscript database?
    ... the individual asking the question in their single context. ... in the current browser instance and a respondent assumes the question ... >>> that the client may download an application from a server ... >>> server, but the APPLICATION may or may not be. ...
    (comp.lang.javascript)
  • Another option (was Re: AJAJS - thin client web app using mainly XMLHTTPRequest and eval())
    ... running on the client. ... but is a Web-Server really an Application Server?) ... Password Caching or generic Work-Station or Browser ... Predictive text on the Queue Name field so that all matching VMS queues ...
    (comp.lang.javascript)
  • Re: Still Need desperate help to start with ASP NET - simplified problems - HELP!!
    ... complicate means that there are some hundred thousand code lines ... via web services to the win appication on the server. ... featured application (say thick client) which does a lot of complicate ... to deliver to the IE user, creating a smart client within its browser. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Still Need desperate help to start with ASP NET - simplified problems - HELP!!
    ... I would like to see * only IE * on the client side and a full ... application on the server side. ... Public Shared Sub MainAs String) ... browser and program so that you can leave all the client server ...
    (microsoft.public.dotnet.framework.aspnet)