If image is already in cache, will using a preloading technique be harmful to load time?
I'm using this technique (mentioned in the comment) for preloading large header images.
The definitive best way to preload images using JavaScript/jQuery?
The upshot is that it calls for loading all of the images in a hidden div on my homepage. If the user hits my homepage multiple times, will these images be pulled from the cache, or will they be "reloaded" if you will from the server?
What I tried
I attempted something like:if(!isset($_SERVER['imgLoaded'])) {
// preload images
$_SERVER开发者_JAVA百科['imgLoaded'] == 1;
}
but it didn't seem to work. (yes, I called session_start() before any headers were sent; Session is working fine.
Assuming your web server sends appropriate http headers to inform the browser the images are safe to cache, yes, its very likely the browser won't repeat http requests unless a refresh is forced.
Here's good info http://www.mnot.net/cache_docs/
I'm not sure why you posted php code...
精彩评论