Re: displaying text while page is loading
From: Dani CS (contusiones.merluza_at_yahoo.es.quita-la-merluza)
Date: 12/21/04
- Next message: Buck Turgidson: "Re: Variables_Order Setting"
- Previous message: Buck Turgidson: "Variables_Order Setting"
- In reply to: Sacs: "Re: displaying text while page is loading"
- Next in thread: yawnmoth: "Re: displaying text while page is loading"
- Reply: yawnmoth: "Re: displaying text while page is loading"
- Reply: Sacs: "Re: displaying text while page is loading"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Next message: Buck Turgidson: "Re: Variables_Order Setting"
- Previous message: Buck Turgidson: "Variables_Order Setting"
- In reply to: Sacs: "Re: displaying text while page is loading"
- Next in thread: yawnmoth: "Re: displaying text while page is loading"
- Reply: yawnmoth: "Re: displaying text while page is loading"
- Reply: Sacs: "Re: displaying text while page is loading"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|