I'm building a website that requires some image preloading, which is handled smoothly with an overlaid splash screen and a progress bar and a spinner.

The thing is, I want the preloader to know if preloading is necessary (the cache has been wiped, or is disabled in the browser), so that it preloads the images whenever needed. My first approach was using cookies, so that the preloader would be shown only the first time, but refreshing without cache after loading the page rendered my first attempt futile. Then I thought about session variables, but I need to be able to set them via javascript (or AJAX) since the preloader is shown via php (to avoid loading it when it's not necessary).

TL;DR: How can I make my website check if the browser is loading from scratch or if it's loading from a cached version?

Here's the link to my website, so you get a clear idea (works better with Chrome and FF).

Edited by Nichito

4 Years
Discussion Span
Last Post by asmira

how would i check if the page is cached, though? As in: if(!cache) preloader()

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.