简体   繁体   中英

HTML5 manifest cache problems

I'm trying to cache (for offline use) some parts of my webbapplication but whenever I cache css files or js files they turn up empty when loaded from the cache (checked both in Safari and Firefox)

What can cause this problem? I have made sure that the manifest file is working properly and I have tried both with relative paths and absolute paths including the domain of the page.

If I exclude all scripts and css files they load just fine but as soon as I put them in the offline cache they get loaded as empty files.

Other offline applications work fine on the platforms I have tested this on so there must be a problem with my setup. The pages get served with an apache server running on linux if this has any effect on things.

Header of request for css file:

Date    Tue, 12 Jan 2010 11:06:41 GMT
Server  Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.4 with Suhosin-Patch
Last-Modified   Thu, 15 Oct 2009 11:53:16 GMT
Etag    "36625c-1da0-475f7ecbca300"
Accept-Ranges   bytes
Content-Length  7584
Content-Type    text/css

This is without the offline cache enabled of course.

Post your response headers for a CSS file. The most likely reason is that the files are expiring.

Seems a little odd to have an Etag but not an Expires or cache-control header. It may be confusing the offline cache. Try explicitly setting a document expiry rule in your server configuration, ExpiresDefault for Apache.

The rules for Etag say if the Etag matches on a subsequent request the server (in this case your offline cache) should send a 304 (use what you already have) and NO DATA. However, if the document isn't in the browsers NORMAL cache and you are offline there is nowhere to retreive the original document from.

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