Simon Willison’s Weblog

Subscribe

Progressive page updates

23rd October 2003

Now this is cool: The joy of flush() shows how PHP’s flush() function can be used to send data to the browser before a page has finished rendering. Check out Ben’s demo page to see the trick in action.

I’ve seen this in use on a few sites for progress indicators, but I’d never realised how easy it was to achieve in PHP. The progress indicator trick is pretty neat—it generally works by having a progress indicator widget that can be modified by javascript, then flushing a <script> element with a call to the progress incrementing function whenever an operation in the server side code has been completed. I’ve seen it used for IRC style chat applications as well, but I’ve always been concerned about the server resources that must be tied up in serving multiple persistent connections at once.

This is Progressive page updates by Simon Willison, posted on 23rd October 2003.

Next: Microsoft's XUL

Previous: Pair Programming

Previously hosted at http://simon.incutio.com/archive/2003/10/23/progressivePageUpdates