9

I'm trying to create an HTML5 Application Cache for a very large (about 2 gigabytes) web app that will be used internally on a Windows 8 Professional tablet and IE10. Something is causing the caching process to fail, but the only debug information I can find is the F12 console, which simply states "AppCache Fatal Error".

I made an error handler and tried to debug:

if (window.applicationCache)
{
    var oAppCache = window.applicationCache;
    oAppCache.onerror = function(e) {
      alert(e); // Outputs [object Event], I use this row as a breakpoint target
    };
}

However, e contains no useful information when viewed with the debugger.

According to the web server logs, the last file requested before the error is a JPEG just like many others. Where should I start looking for clues about what is causing the error? The page caches fine on Firefox.

Kaivosukeltaja
  • 15,541
  • 4
  • 40
  • 70

5 Answers5

9

Bashed my head against the same issue for a while. I binary-chopped my manifest until I worked out which line was causing the error: it was the 1000th line of CACHE entries (not just the 1000th line of the manifest).

It seems there's a hard limit on the number of items you can have in a cache in IE10. I haven't found this documented anywhere after a few minutes searching, but I daresay someone more persistent might trawl it up.

I verified that it doesn't matter what the content of the 1000th CACHE item is; IE just prevents you outright from beginning the cache download. It might be a restriction for security reasons, stopping someone flooding the cache, or using it to DoS a site by injecting a manifest with thousands of entries into a page.

Perhaps try splitting your app into chunks (over subdomains?) with different caches. Might make for a better user experience if it's downloaded in chunks, you can always automate the "install" by redirecting between a series of smaller caches.

Rhysk
  • 106
  • 1
  • 1
    The subdomain split is a nice idea, although it would be hard to implement as the site is single-page. Beside the 1000 cache entry limit there also seems to be a 50MB limit and this looks like to be the culprit in our case. The 1000 item limit would have bitten us anyway if it were not for the huge videos, so I'll accept this answer. Thanks! – Kaivosukeltaja Jun 10 '13 at 08:02
  • 1
    Well spotted. The details for IE10 are [here](http://technet.microsoft.com/en-us/library/jj891001.aspx) and do confirm the 50MB limit and maximum of 1000 resources in the manifest. – Barrie Jul 01 '14 at 08:34
7

For the record: I had trouble with IE (10) giving me AppCache Fatal Error. It turns out IE requires the manifest to be served with the proper content-type, that is

Content-Type: text/cache-manifest

Chrome and Firefox aren't as picky.

derflocki
  • 863
  • 1
  • 11
  • 19
3

In case it helps anyone, I've found another way to rectify this error.

If you are using the Application Cache and set the Cache-Control header for the html file with the cache.manifest entry to "Cache-Control: no-cache, no-store", you will receive this error. Removing the no-store flag for the Cache-Control header will fix the issue in this instance. I was trying to use the Application Cache for resources only and not for the html page itself, but unfortunately that's not what it was designed for.

Also note that all other browsers will just ignore the no-store flag for files in the cache.manifest, whereas IE is technically doing the right thing by being a little more pedantic.

Sav
  • 310
  • 1
  • 10
1

Internet explorer Group Policy sets limitation of cache resource list size to 1000 items. This can be extended by changing this policy. More can be found here , part "Set maximum application cache resource list size".

neemanjabu
  • 199
  • 1
  • 4
0

My problem was, that IIS used the .manifest-Extension and set the Content-Type to x-ms-manifest. So I added the following into the web.config - this solved the fatal error (IE 11) and the appcache now works with HTTPS (SSL) which it didn't before (only worked with HTTP):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="."
            inheritInChildApplications="false">
    <system.webServer>
...
      <staticContent>
        <remove fileExtension=".manifest"/>
        <mimeMap fileExtension=".manifest" mimeType="text/cache-manifest"/>
      </staticContent>
...
    </system.webServer>
  </location>
</configuration>
NoRyb
  • 1,472
  • 1
  • 14
  • 35