Question

<!DOCTYPE HTML>
<html manifest="example.appcache">
<link rel="stylesheet" type="text/css" href="AppCache.css">
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<p>Test to make sure css is being cached</p>
<img src="large.jpg">
<script src="AppCache.js"></script>
</body>
</html>

My example.appcache file has:

# v1 11/16/2011
AppCache.htm
AppCache.js
AppCache.css
large.jpg

The first time I navigated to the page, it asked

This website is asking to store data on your computer for offline use.

When I take Firefox offline and press refresh, the jpg disappears.

Q: What do I need to do to make sure the image is cached locally?

Was it helpful?

Solution

IIS does not serve unknown file types. You need to configure it to serve .appcache files with the MIME type text/cache-manifest, how you do this depends on which version of IIS you have:

OTHER TIPS

I just want to comment on the accepted answer here, as the mimetype mentioned does not work (at least in IIS7.5). The correct mimetype is:

text/cache-manifest

See: https://developer.mozilla.org/en/Using_Application_Cache

http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html#offline

Do not forget that you need

CACHE MANIFEST

At the top of you manifest document. It is required.

CACHE MANIFEST
# v1 11/16/2011
AppCache.htm
AppCache.js
AppCache.css
large.jpg

That should do the trick

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top