views:

590

answers:

1

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.

A: 

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.

SpliFF
Posting in original post since the comments can't handle code?
Kristoffer L
It did not help the problem. I put the cache time to one week and cleared all information but the problem persists.Offline css and js files are still empty.
Kristoffer L