There was a time when I did not clean up the temporary files (cache files) of IE, when I cleaned up, I suddenly found a problem.
I opened a Web site, the picture default cache for one months, but I found that when I upload pictures or delete pictures after the image is re-cached, it means that when I upload new images or delete images, all the original images on the page are re-loaded, re-cached.
From this point of view, the cache of the image itself has no meaning at all.
I looked at the JavaScript code of the Web page and found that after uploading or deleting it, the call was Location.reload ();
Does this location.reload () not only reload the page, but all the resources on the page will be re-loaded.
I searched the internet for a bit and said this location.reload (Boolean state); There is an optional parameter, and the default is False.
I can go through my tests either: location.reload () or Location.reload (true) will reload all the pictures on the page when the page is refreshed. As their introduction says, Location.reload () is the equivalent of pressing the F5 key on the Web page to refresh.
But for my current application, I just want to refresh the content of the page and not let the previously loaded cached pictures reload again.
This is important, if every refresh is loaded with all the pictures, this will be a very waste of bandwidth and resources for the server.
I also see another way to refresh the page online: Location.replace ();
Window.location.reload () or document.location.reload (); 2 different ways
After I tested the location.replace () to replace the original Location.reload (), it was possible to update the contents of the page without reloading the previously existing images in the IE cache, so that the cache of the image itself was meaningful.
2010-11-06
The difference between javascript:location.reload () and Location.replace () and the effect on the image cache.