Different Manifest files when having a cached web app? - html

I've just started reading the explanation of the HTML 5 cache in w3schools and there is some confusion in my head regarding this.
consider having this manifest file:
CACHE MANIFEST
/main.html
/logic.js
This file will load these two files. My question is what will happen when you have this:
CACHE MANIFEST
/main.html
And you load logic.js in the main.html. Will it still work?

Related

how to configure a manifest file

This is my first time in stackoverflow so if i break any rule or something, please tell me and ill try to fix it asap.
Im trying to configure a manifest (appcache) file to download 2 files( one html and one JS) and be able to use that HTML in offline mode, but after many trys, i couldnt configure the manifest file (or maybe is something else fail?) to store the appcache files.
At the moment i have in the same folder, 3 files: juego.html , damas.appcache and juego.js
damas.appcache:
CACHE MANIFEST
CACHE:
juego.html
juego.js
NETWORK:
*
and in the html file...
juego.html:
<!DOCTYPE html>
<html manifest="damas.appcache">
...
I dont think that more HTML code or the javascript code is needed for my explanation but if needed, ill put it.
¿How can i got the files to be stored in local?
Thanks to all
It's possible that you have an older version of the html cached. This seems to be the case because your setup looks correct, but you are missing a unique value—such as a timestamp—in your damas.appcache. The cache manifest only gets updated when there is a change to that file.
It's also possible that your mime-type is incorrect. Ensure that the mime-type set for the cache manifest is set to text/cache-manifest.
Apache:
AddType text/cache-manifest .appcache
References:
See Cache manifest on my website: http://pygeek.com
See A Beginner's Guide to Using the Application Cache: http://www.html5rocks.com/en/tutorials/appcache/beginner/

HTML5 use cache only when offline

I started to use HTML5 cache to view a simple HTML page with one css file and two js files.
My problem is that the cache is used whether I'm offline or not. But I just want to use the cache when I'm offline.
Does anyone know how to solve this?
index.html file manifest:
<html manifest="app.cache">
app.cache manifest file:
CACHE MANIFEST
/index.html
/css/style.css
/js/jquery-1.7.1.min.js
/js/functions.min.js
Thank you!
According to the standard as given at whatwg, this is possible by changing the cache mode from the default fast to the prefer-online state. There, the instructions given are to add the following at the end of your appcache manifest, after listing all the files you need available offline:
SETTINGS:
prefer-online
NETWORK:
*
Apparently the idea behind this is to allow adding basic offline support to "legacy" applications that cannot help having to change the html document everytime it is served. I have not verified that this works in any current browser.
manifest="app.cache" - not going to solve your problem. It caches all the file listed in manifest file. You have to save your data in local storage or in local db and have to retrieve data from server/local based on connection status [online/offline].

How to execule file from the cached file in html5 offline?

I wrote a cache.manifest for my html5 page (index.php)
The content in cache manifest:
CACHE MANIFEST
#version 1.0 09-16-2011
CACHE:
/images/app.jpg
/css/app.css
/js/app/js
NETWORK:
*
The static files are cached ok, but the host file index.php is cached too.
If i remove the cache.manifest from index.php, it'll never be cached.
How can i exculde index.php from the cached files?
It's not possible to exclude the linking page (at least for now... HTML5 is still a draft) from the cacheing process.
PS: it's also incorrect to speak about .manifest, while W3C introduced a new definition .appcache (http://www.w3.org/TR/html5/offline.html)
The only way to exclude it is not to link to the manifest from it. Pages which reference a manifest file are always cached.
If you don’t want to cache index.php add it to the NETWORK section of your manifest: resources in there are never cached and aren’t available off-line.

HTML5 Offline Storage - Cache manifest networking

I am trying to write the manifest file but I am having weird problem in FF5, its caching all despite saying to don't do so. My manifest file looks like:
CACHE MANIFEST
NETWORK:
*
any ideas?
http://www.html5rocks.com/en/tutorials/appcache/beginner/
this says if you reference the manifest file in html files as manifest attributes then it will be cached even if its not listed in manifest file.
I did a presentation about offline and local storage not long ago.
Video available here: http://www.youtube.com/watch?v=AWCk6FZMpcU
It's a bit complicated. I had to read Dive Into HTML5 multiple times and then experiment a lot to get things working.
I have an example PHP manifest "build" script here: https://github.com/JasonHanley/note5/blob/master/build.php
It seems you don't have anything set to cache, why would you need a cache manifest file if this is the case? If you are trying to cache some things I would try properly defining them under CACHE: and see if it then cache's the appropriate assets.

HTML5 cache manifest and prefetching

One thing I'm not fully grasping is if the cache manifest is also acting as a prefetch when it is online for all the files listed.
For example, lets say I'm visiting:
/page1.html
Each of the pages on my site will have the same declaration:
<html manifest="/cache.manifest">
In the cache manifest file, I have:
CACHE MANIFEST
/page2.html
/page3.html
/page4.html
So what will happen is I visit /page1.html first, and when I'm online my browser will know to cache pages 2-4 also. And when I'm disconnected and I visit pages 2-4 everything will load just fine because it was already cached.
QUESTION: If I visit /page1.html, and I'm STILL connected online, and visit /page2.html, will my browser still request /page2.html, or will it not make another request to the server and use what it cached from the /cache.manifest file? Essentially acting like the prefetch link that firefox uses?
Well, the spec says "all files," without any exceptions for html files, so I figure it works for html files just like any other, it gets taken from the cache, not the server. However, I have not done any testing to confirm this. I would do the following:
Create the following cache manifest file:
CACHE MANIFEST
/page1.html
/page2.html
/page3.html
/page4.html
Include it in each of the four cache manifest files. Then:
Visit page1.html
Edit page2.html to make it different than before you visited page1.html
Visit page2.html
See which version you get.
Make sure you try it out on all browsers. I'll be interested to see your results.
When we use cache manifest it takes the files from the cache each time you load the page.
There is a solution for this.
You have to change the version number in the manifest file, If at all you have done any changes to the HTML files. so that your manifest pulls in the latest version of the HTML from the server and Stores it in Cache.
CACHE MANIFEST
#v01
/page1.html
/page2.html
/page3.html
/page4.html
You can just Increment the V01 to 02,03... So on, this will ensure your cache will have latest version of html pages
I think it takes it from the manifest file even if you are online :). Can't you try it out by uploading a file and then navigating to the page?