> How does a server push content to a browser -- or rather, how
> does it appear to
> do such?
>
> For example, consider a chat room application (like
> http://phpopenchat.org/features.php), where the text from users
> appears on the
> screen as users enter it in. All, without an annoying flash of a
> meta-refresh
> tag, or a page reloading or anything.
>
> Are they using javascript on a timer to poll the server to get
> the info and post
> it? Anybody ever done this?
>

I've done something similar at work for one of our projects. The reality is
for any web application, the browser has to initiate each request, although
it's simple to make it appear that the server is simply sending information
without a request from the browser.

Using a hidden iframe and some javascript, it's fairly easy to do. The
javascript refreshes the iframe at a regular interval which queries a
server-side script, and the script outputs the most recent chat from the
server that hasn't been culled by this client. Each time there is something
new from the server, the javascript it to the chat in the browser.

Jon


____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to