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
- Gemini 2.0 Flash: An outstanding multi-modal LLM with a sci-fi streaming mode - 11th December 2024
- ChatGPT Canvas can make API requests now, but it's complicated - 10th December 2024
- I can now run a GPT-4 class model on my laptop - 9th December 2024