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.
More recent articles
- OpenAI DevDay: Let’s build developer tools, not digital God - 2nd October 2024
- OpenAI DevDay 2024 live blog - 1st October 2024
- Weeknotes: Three podcasts, two trips and a new plugin system - 30th September 2024