HM2K
HM2K

Reputation: 1511

Turn off Application Cache with manifest

I'm writing a HTML5 application that uses "Application Cache with manifest".

However, while I'm developing I want to turn it off.

I tried removing the manifest attribute from the tag and switching everything to network in the manifest file.

Although it did update on the first update, all subsequence updates are still read from the cache rather than the server.

I can see that the HTML file has updated and there is no longer a manifest attribute on the tag, yet it still loads from the cache.

I can't seem to figure out how to turn it off once you've set it, so here's my question:

Is there a way to turn off "Application Cache with manifest" in Google Chrome?

Upvotes: 13

Views: 15315

Answers (6)

Dmitry Vasilev
Dmitry Vasilev

Reputation: 6508

This is working for me in desktop and mobile Safari(also at Home Screen) I think this can work in other webkit browsers like Chrome.

  1. Change server MIME to "text/cache-manifest" for all ".appcache" files
  2. Add to html

<html manifest="example.appcache">

  1. Use this "example.appcache" file

CACHE MANIFEST
# 2016-01-07:v1.0.4

# This is the default section for entries. Files listed under this header (or immediately after the CACHE MANIFEST) will be explicitly cached after they're downloaded for the first time.
CACHE:


# Files listed in this section may come from the network if they aren't in the cache, otherwise the network isn't used, even if the user is online. You can white-list specific URLs here, or simply "*", which allows all URLs. Most sites need "*".
NETWORK:
*

# An optional section specifying fallback pages if a resource is inaccessible. The first URI is the resource, the second is the fallback used if the network request fails or errors. Both URIs must from the same origin as the manifest file. You can capture specific URLs but also URL prefixes. "images/large/" will capture failures from URLs such as "images/large/whatever/img.jpg".
FALLBACK:

Upvotes: 0

Peter Egan
Peter Egan

Reputation: 1

When working with an application with a manifest, I create two start pages: - index.html which has the manifest information included - index.dev.html which DOES NOT have the manifest information

I usually launch from the index.dev.html in my development environment so I can debug with the cache getting in the way. Once the code is debugged, I launch from the index.html file to make sure I have the appcache file configured correctly.

Upvotes: 0

Scott
Scott

Reputation: 1548

You can disable the application cache in Chrome via the "--disable-application-cache" command-line switch (this is in the dev channel of Chrome, using a linux build... but I'm sure it's the same in the beta/standard channels, and for other platforms):

google-chrome --disable-application-cache

Upvotes: 1

robertc
robertc

Reputation: 75707

In Chrome, go to Under the bonnet -> Content Settings -> Cookies -> Show cookies and other site data, application caches should show up under the site data.

In Firefox go to Advanced -> Network, sites with application caches are listed in a box at the bottom.

There's no way completely to completely remove or expire an application cache from the server side at present. The best you can do is explicitly tell the browser to remove all the cached files - a manifest with just a network section should delete all the other files, but the file with the manifest reference will itself always be cached.

--edit

This answer is no longer entirely correct. Currently the standard states:

If fetching the manifest fails due to a 404 or 410 response or equivalent...Mark cache group as obsolete. This cache group no longer exists for any purpose other than the processing of Document objects already associated with an application cache in the cache group.

That is: deleting the manifest file should cause the appcache to be deleted the next time the browser attempts to update

Upvotes: 21

Mario Estrada
Mario Estrada

Reputation: 475

Delete the manifest file in your development computer.

Upvotes: 3

Laurent T
Laurent T

Reputation: 1098

I would suggest that everytime you change anything in your application, you have to change the manifest file as well so the latest modification you have just made will be taken in account.

When I say change the manifest, you can just change the version number in a comment like this:

# version 1

It's more convenient this way rather than cleaning the cache everytime (and at the same time loosing other information for other sites, so you need to log in again and again... etc)

Upvotes: 0

Related Questions