سؤال

I have a webpage that has a large list of gifs on it. If I navigate to the page frequently throughout the day, will I be using a lot of bandwidth to load all of the gifs, or do the images get cached somewhere? Is there a way to reduce the bandwidth I use if I know I will be navigating to this page frequently?

هل كانت مفيدة؟

المحلول

In most of the normal cases the browser will cache your images. By most of the normal I mean that the server is configured to add expires headers. If you are using apache - you can look here how to do this. Another way of doing, but worse it to do this through the application. Also I assume here that the browser is not told explicitly not to cache something you can do this by prepending ?random_stuff to your image src in the end.

To check if the images you are currently viewing are taken from cache - check your response status. For example in chrome inspector if you see 304 this means that it was taken from the cache. enter image description here

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top