Outdated HTML 5 cache manifest

I am trying to get HTML5 offline storage to work in a basic way. I read the information about DiveIntoHTML5 , and it seems to make sense, but it doesn't seem to work for me. I was wondering if anyone could help me debug this.

I basically created the homepage for the application, index.htm. Therefore, my application is located on the Internet at http://www.mydomain.com/online/index.htm . Users visit this page, where every day every day every day will do its job. Visiting this URL will create a bunch of cached files so that they can then visit http://www.mydomain.com/offline and view the working version of the application when they are offline.

The top few lines of code on the online homepage:

<!DOCTYPE html> <html manifest="cache.manifest"> <head> ...etc 

I created a simple text file called cache.txt and added the following notepad to it:

 CACHE MANIFEST http://www.mydomain.com/offline/scripts/jquery-1.6.3.min.js http://www.mydomain.com/offline/scripts/jquery-ui-1.8.16.custom.min.js http://www.mydomain.com/offline/scripts/modernizr.min.js http://www.mydomain.com/offline/scripts/json2.min.js http://www.mydomain.com/offline/scripts/jquery.deserialize.js http://www.mydomain.com/offline/scripts/jquery.cookie.js http://www.mydomain.com/offline/scripts/main.js http://www.mydomain.com/offline/css/main.css http://www.mydomain.com/offline/css/structure-details.css http://www.mydomain.com/offline/css/ui-lightness/jquery-ui-1.8.16.custom.css http://www.mydomain.com/img/header.gif http://www.mydomain.com/offline/img/bg.png http://www.mydomain.com/offline/img/header_riser.gif http://www.mydomain.com/offline/img/logo.png http://www.mydomain.com/offline/img/offline.png http://www.mydomain.com/offline/index.htm 

Then I renamed this file to "cache.manifest" and uploaded it to the root of the online application (at the same level as my home page) so that it is available at http://www.mydomain.com/online/cache .manifest .

The hosting company supposedly added the "text / cache-manifest" content type to all files with the .manifest extension in IIS. I think this works because when I view a file in Firefox at http://www.mydomain.com/online/cache.manifest Firebug tells me what the content type is:

 Content-Type cache-manifest 

Or should this return "text / cache-manifest"? Perhaps this is a problem?

When I look at the offline storage folder on my system (C: \ Users \ Me \ AppData \ Local \ Mozilla \ Firefox \ Profiles \ b12u6xza.default, there is nothing connected there with this domain.

Can anyone suggest what might be wrong - how am I a little puzzled?

+4
source share
4 answers

First of all, the specification has changed, now you should use .appcache as an extension of the manifest.

Secondly, the mime type must be defined as you say text/cache-manifest . I really am not connected with IIS, but it seems that there are two ways to add this type of MIME: either through the administration IIS interface or through the web.config file

In addition, I would recommend that you test this using Google Chrome, since all analysis data and analysis errors are displayed on its console, including when the MIME type identifier is not recognized correctly.

+1
source

try adding these lines to httpd.conf .. this may help you

 AddType text/cache-manifest .manifest <IfModule mod_expires.c> ExpiresActive On ExpiresByType text/cache-manifest "access plus 0 seconds" </IfModule> 
0
source

Better to test using the chrome console! (you cannot see them on the chrome network)

My example (visit: www.mustrank.com/views/1.php).

Look at the chrome console output below, the manifest file "website.appcache" is created first, and then the sources "1.html" and "main.css" are loaded

[Creating an application cache with the manifest www.mustrank.com/views/website.appcache 1.php: 1

Cache event for checking applications 1.php: 1

Application Cache Download Event 1.php: 1

Application Cache Execution Event (0 of 2) www.mustrank.com/views/1.html 1.php: 1

Application Cache Execution Event (1 of 2) www.mustrank.com/css/main.css 1.php: 1

Application Cache Execution Event (2 of 2) 1.php: 1

Application Cache Cache]

0
source

There are some issues you should take care of:

  • Chrome (and I think all browsers finally) only processes the cache file through secure requests . If your request is not secure, your cache will not be executed.
  • Mobile browsers (at least devices that I could test) do not care about safe or insecure requests. But I would rather be prepared for a policy change .
  • I puzzled trying to understand why in Android my file worked fine, but in iOS it failed, and the reason is that I launched my browser in incognito mode. Incognito iOS cannot cache the page and you get an error.

If I find more problems, I will write it down.

Sincerely.

0
source

All Articles