Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out what causes AppCache Fatal Error on IE10?

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.

like image 524
Kaivosukeltaja Avatar asked May 31 '13 13:05

Kaivosukeltaja


People also ask

Which event is fired by the AppCache object when the cache download is complete?

Once that happens, an updateready event will be fired, stating that an updated copy of the cache has finished downloading and is ready to be used.

What is AppCache API?

The Application Cache (AppCache) API allows offline access to your application by providing the following benefits: Performance - Specified site resources come right from disk, avoiding any network trips. Availability - Users can navigate to your site when they are offline.

What is the purpose of AppCache API in html5?

The Application Cache (or AppCache) allows a developer to specify which files the browser should cache and make available to offline users. Your app will load and work correctly, even if the user presses the refresh button while they're offline.


2 Answers

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.

like image 150
Rhysk Avatar answered Sep 22 '22 16:09

Rhysk


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.

like image 40
derflocki Avatar answered Sep 19 '22 16:09

derflocki