HTML5 Cache Manifest Not uploading - html

I am working on an offline application in HTML and am having a problem using the HTML5 manifest. I am able to get it to download all the files and the manifest but when I change the manifest it does not do an update.
I see a record of the browser downloading the manifest in the web server log, and it does issue a bunch of progress events. However there is no record in the web server log of it downloading any of the files listed in the manifest nor do any changes show up in the browser.
This is with firefox 3.6.4.
Any ideas?

The manifest itself is still subject to normal browser caching rules, make sure you serve the manifest files with an expiry header set to immediate. You can do this on Apache in .htaccess with this:
<IfModule mod_expires. c>
ExpiresActive on
ExpiresByType text/cache-manifest “access plus 0 seconds”
</IfModule>
In the short term, try hitting Ctrl+F5 to force a full reload or clearing your browser cache.

Related

Appcache Manifest not working

I have the following appcache manifest:
CACHE MANIFEST
# Cache Manifest timestamp: 1361723106
CACHE:
offline.html
offline2.html
offline.manifest.php
NETWORK:
*
FALLBACK:
/ offline.html
I am using this on my local installed server.
So when I load the index.html file which links to this manifest file, the consolse in Chrome shows me that all files are cached properly. When I now shut down my local server and try to access the index.html file again, then I see the content of that index.html file. I was expecting to be "forwarded" to offline.html. What am I doing wrong?
Thanks in advance!
Although you speak of an "index.html" file, I'm assuming you're accessing the resource like this: http://yourlocalservername/ .
The resource that links to the appcache manifest (in this case "/") is always included in the application cache. Fallback applies to resources which are not in the cache, so the result you get is expected.
The only way to show an "offline indicator" when accessing a previously cached resource, is to ensure the cached resource includes javascript code that actually checks if the browser is offline. You could check navigator.onLine and/or check with XMLHttpRequest to see if your server is reachable (and functioning).

appcache is trying to cache all files

I'm trying to make a appcache file but got some problems... I've added the appcache file to the server, here is its content:
CACHE MANIFEST
CACHE:
scripts/jquery-1.5.1.min.js
But after refreshing the page I got all my web site files missing (styles, js scripts, images etc.), I mean they are not loading anymore and browser always try to get them from local cache. But what I want is just to cache some of them, I don't want to specify ALL my files in the appcache (to CACHE section or to NETWORK section), is this possible?
Don't use the HTML5 app cache for what you are trying to do.
Browsers already cache certain resources from a website and you can choose how the browsers should cache the files by manipulating the HTTP headers. For example, Stack Overflow loads their jQuery library from Google and Google sets the HTTP header: "Expires: Sat, 16 Mar 2013 05:41:47 GMT". Every website that links to this file won't have to download it anymore because the browser will keep it in it's cache for the next year.
For the files on your own website you will have to find out which webserver is running your site. For the Apache webserver follow these instructions, for IIS follow these instructions.

Using manifest property in html5

From what I userstand,
<html manifest="test.appcache" xmlns="http://www.w3.org/1999/xhtml">
that is a sample on how one would use the manifest property.
CACHE MANIFEST
CACHE:
# Offline cache v2
# html files
index.html
# css files
styles.css
# js files
main.js
and the above is a sample of the manifest file.
However, when I try to run it from my iTouch, the cache is not working.
I just want to ask if the server affects if certain html5 property work? because the server I am using is quite old.
Thanks in advance
You have to make sure that the server delivers the manifest file with a MIME type of
text/cache-manifest
This could be done (assuming you're using apache) by adding
AddType text/cache-manifest .appcache
to your .htaccess file in the directory the manifest is residing in.

Is there a trick to get an index.jsp file auto redirected to by Tomcat, to use the html cache manifest?

I have a properly generated cache.manifest file.
I have ensured that it is being served with the correct mimetype.
I have an index.jsp file which correctly references the cache.manifest file.
I have set up Tomcat so that if I hit http://example.org/ it will load index.jsp
When I hit http://example.org/index.jsp
The cache.manifest is read, processed and works! Chrome shows all of the caching events.
Repeated visits show the Application Cache Checking event, Application Cache NoUpdate events in Chrome
When I hit http://example.org/
The browser acts as if there is no cache.manifest at all!
There are not cache events sent to the Chrome console
Is there a trick to get an index.jsp file auto redirected to by Tomcat, to use the html cache manifest?

HTML5: Why I need to add manifest file to .htaccess?

I have seen some articles about HTML5 Manifest, which say that we must add manifest file to .htaccess with following line:
AddType text/cache-manifest .manifest
However, there is no any explnation what is the purpose of adding?
Where should I place this .htaccess file ? in the same folder where the manifest file is? and finally how can i make sure that it is added to .htaccess successfully?
Even if i do not create any .htaccess file, i only add this to my html file
<html manifest="site.manifest">
I can see the popup bar in firefox, asking that the website is asking to store data. So isn't it working without this .htaccess?
I'll appriciate if anyone can explain. Thanks.
You don't "add a manifest file" to .htaccess with that line. That line just tells Apache that files with the suffix ".manifest" will be of type text/cache-manifest. Apache tells the client about the file type in the HTTP content-type header. The HTTP content-type header is required for the browser/client to understand how to interpret the contents of the file. Refer:
AddType Directive # httpd.apache.org
The cache manifest in HTML5 # en.wikipedia.org
The cache manifest syntax # w3.org
Offline Web Applications # w3.org