简体   繁体   中英

HTML5 cache nothing

I don't want to cache anything on my site. my cache.manifest looks like this: CACHE MANIFEST

# Cache manifest version 1.1

CACHE:
#nothing to cache.

NETWORK:
#force no cache
*

This is decalred at header

<html manifest="/cache.manifest">

which is included in each page.

<%@ include file="/WEB-INF/html/header.html" %>

Contents are still being cached. Firefox still displays the warning "This website {example.com} is asking to store data on your computer for offline use".

Details specs:
Apache 2.2
Tomcat 7
cache.manifest is at root.
app is ROOT.war , which is serving root of domain.
Am I missing something?

A manifest is for specifying what content you want to be cached for offline use . It has nothing to do with regular caching.

Firefox will prompt for storing data for offline use any time there is a manifest attribute on the html element, even if the value of it doesn't do anything useful.

If you want to control regular caching, then use cache control HTTP headers such as:

An Expires in the past.

Expires: Fri, 30 Oct 1998 14:19:41 GMT

And/Or Cache-Control :

Cache-Control: max-age=0, no-store

What's the reason behind using a manifest?

HTTP headers are the place for cache control. Add Cache-Control: no-cache in your response headers. http://condor.depaul.edu/dmumaugh/readings/handouts/SE435/HTTP/node24.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM