Application cache

<!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> 

In my example.appcache file there is:

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

The first time I went to the page, he asked

This website asks you to store data on your computer for offline use.

When I take Firefox offline and click update, jpg disappears.

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

+6
source share
3 answers

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 it depends on which version of IIS you have

+18
source

I just want to comment on the accepted answer here, as the mimetic mentioned does not work (at least in IIS7.5). The correct mimetype type 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

+8
source

Do not forget what you need

 CACHE MANIFEST 

At the top of your document. It's necessary.

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

That should do the trick

+2
source

Source: https://habr.com/ru/post/901663/


All Articles