This isn't really a PHP question. Except that's what I code in now.
On a typical discussion forum (phpBB, phorum or any one of a hundred others) let's say there is a long discussion thread going with 20 or more comments to the original post, and where each such comment includes one or more photos, perhaps 700 pixels wide. That's a lot of bandwidth.
I just emptied my Firefox cache and looked at just such a thread. And yet it loaded quickly. If I scroll all the way down to the bottom of the thread (which appears as if it were one loooooooong HTML page) there are close to 40 big photos on display. However, because these are big images the browser display can only show one or two such images at a time.
So I'm assuming (am I right?) the browser only downloads the images one or two at a time, as the viewport requires. How does that work? Does this require something special done in the server-side PHP? Browser-side Ajax (I doubt that......many of these forums preceded Ajax)?
Or does the browser download ALL of the HTML, all at once, but then makes secondary GETs one or two at a time, in order to display images? And if so, how does the browser know which images are currently scrolled to the browser's viewport?
What am I missing?
When you see a web page jump around a lot (annoying as hell) it is because the images don't have width and height attributes so html reserves a standard width and height which is later changed to match the image's width and height causing the whole page to redraw. There should be a special
coders who create these unsteady pages.
There used to be a website that showed how a web page loads, showing the time for each resource but I can't find it now.
This topic is now closed. New replies are no longer allowed.