Image caching using javascript

Here I’m going to say a simple way to cache images while loading web page using JavaScript. Well we know where the images are located in our server. So first we need to specify the path of images into an JavaScript array, which you want to cache while loading a web page as shown below:

 

Copy and paste the above code inside the head tag of your web page and call the function preCacheImages()  in onLoad event of body tag.

<body onload=”javascript: preCacheImages(arrImages);” >

 

Read More