In an attempt to improve responsiveness, I’m figuring that it would be a good idea to preload paginated data.
The reasoning goes like this: When a user reads through paginated data, they are most likely to go through the pages in order. Therefore, it would make sense to spend the time taken for the user to read the current page, loading the following page into memory (AJAX call, save the resulting HTML, and then just having the “next page” link replace the content’s innerHTML instead of loading a new page). Similarly, I can keep previously loaded pages in memory so that, if the user goes back, the page can reappear instantly without having to make another roundtrip to the server.
My main concern is the impact this may have on the browser’s RAM usage. I mean, all of a sudden I’m having it hold several pages instead of just one. That said I’ve been on webpages that are a good hundred times bigger than a single page of my layout and they worked just fine, so am I overthinking this?
My other concern is that the data may change (I’m currently thinking of the forums, where a user may edit a post or (in the case of the last page) a new post may be made. I guess I could avoid storing the last page in memory, but is there any way I can go about checking for modified posts without defeating the purpose of the whole cache system? The best I can come up with is similar to static resource caching, where a request can be made but the server can respond with Not Modified if that’s the case. But then again there’s likely to be a whole lot more viewing of pages than editing them, so almost all of the requests would be Not Modified. I’m just not sure how to go about doing all this, or if it’s just not worth worrying about.
Many sites use “infinite” scrolling where many, many images are allowed to be loaded at once. I believe most browsers manage memory based on what is actually being displayed. Having “infinite” scrolling can be more user friendly than doing pagination in some situations.
You can have a “last modified” tag on a thread – then when you check for normal updates from the site you can compare the last modified with the stored date in the html. If the change is recent then get and update the latest versions of the posts. Honestly it’s probably not worth worrying about – people are used to reloading their browser to check for changes.