开发者

Keep background images in HTML pages

开发者 https://www.devze.com 2023-03-21 02:53 出处:网络
I have several web pages that share common backgroun开发者_StackOverflow社区d images. When I open

I have several web pages that share common backgroun开发者_StackOverflow社区d images. When I open each one of them, the images are loaded again each time.

Is there a way to keep the images from loading each time since most of them are just the same?

I am using HTML / jQuery.

Thanks in advance

H


I'f the images are the same just make sure they have the same name and most web-browsers will cache them automatically.


If your webpages are all on the same server and reference the same image file on the server then they will not be downloaded again, merely refreshed


If the images are mostly same(also coming from same location in all the pages) you dont have to worry the browser will cache them and wont download each time unless you have disabled caching.


User Caching may need to be turned on via your hosting software (Apache, IIS, etc.). You also may need to setup your server to send expiration headers with requests so browsers know to look for updated content or not.

If you set the expiration headers for images to be sometime in the future then browsers will not re-download the images each page as the browser will know to not look for those images again until the expiration date.

Google's Page Speed is a good way to check if the correct headers are being sent on your server: http://code.google.com/speed/page-speed/

Another great tool for checking the headers sent by your server is Firefox's Firebug. If you have this tool, check-out the "Net" tab and you can see the responses of all the assets loading on your page.

0

精彩评论

暂无评论...
验证码 换一张
取 消