Stop browser to make HTTP requests for images that should stay cached - mod_expires

后端 未结 10 1043
猫巷女王i
猫巷女王i 2020-12-04 10:01

After reading many articles and some questions on here, I finally succeded in activating the Apache mod_expires to tell the browser it MUST cache images

10条回答
  •  余生分开走
    2020-12-04 10:44

    There's a difference between "reloading" and "refreshing". Just navigating to a page with back and forward buttons usually doesn't initiate new HTTP requests, but specifically hitting F5 to "refresh" the page will cause the browser to double check its cache. This is browser dependent but seems to be the norm for FF and Chrome (i.e. the browsers that have the ability to easily watch their network traffic.) Hitting F6, enter should focus the URL address bar and then "go" to it, which should reload the page but not double check the assets on the page.

    Update: clarification of back and forward navigating behavior. It's called "Back Forward Cache" or BFCache in browsers. When you navigate with back/forward buttons the intent is to show you exactly as the page was when you saw it in your own timeline. No server requests are made when using back and forward, even if a server cache header says that a particular item expired.

    If you see (200 OK BFCache) in your developer network panel, then the server was never hit - even to ask if-modified-since.

    http://www.softwareishard.com/blog/firebug/firebug-tip-what-the-heck-is-bfcache/

提交回复
热议问题