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
- Qwen2.5-Coder-32B is an LLM that can code well that runs on my Mac - 12th November 2024
- Visualizing local election results with Datasette, Observable and MapLibre GL - 9th November 2024
- Project: VERDAD - tracking misinformation in radio broadcasts using Gemini 1.5 - 7th November 2024