badal
badal

Reputation: 73

Store image in cache memory

I want to store image in cache memory to speed up my website. So, how to store image in cache memory in Javascript or jQuery for website's speed optimization?

Upvotes: 1

Views: 2612

Answers (3)

OverFlowiPhone
OverFlowiPhone

Reputation: 59

try this

$('#gallery img').each(function(i){
    if(this.complete){
        doSomething();
    } else {
        $(this).load(function(){
            doSomethingElse();
        });
    }
});

Upvotes: 1

chinnychinchin
chinnychinchin

Reputation: 5674

You can force the 'loading' into cache of these images upfront by using HTML hidden img tags on the initial load. Later HTTP requests for the same images should return from cache.

By default, most browsers do the caching for you, provided you do not provide other instructions in the HTTP response headers for those image resources.

Upvotes: 4

Vasant
Vasant

Reputation: 1038

Google will help you!

Take a look http://developer.android.com/guide/topics/data/data-storage.html#filesInternal

Upvotes: -2

Related Questions