APPLICATION CACHE

HTML5 to create an OFFLINE version, ie you do not need Internet, a Web application ONLINE, by creating a file where you specify the files or web components that the browser should cache.

Advantages.

1.- The website will be faster because the components cached load faster.
2.- Reduces server load, because it only re-query the server components or files that have changed since your last download on the client.
3.- Users can interact with the Web application, without Internet connection.

Syntax for specifying a web page is cacheable components:

We have the following website (demo.htm) that has defined the application cache file "file.appcache".

<!DOCTYPE HTML> <html manifest="file.appcache"> <body> … </body> </html>

Syntax to specify the file with the components to be cache

The file "file.appcache" would be something like:

CACHE MANIFEST /style.css /image.JPG /javascript.js NETWORK login.php FALLBACK /tutorialHTML5/ /offlineHTML5.html /tutorialSQL/ /offlineSQL.html

Explanation of the previous file:

CACHE MANIFEST

The files listed under this heading, will be cached by the browser after the first discharge.

That is, the file "style.css", "image.jpg", "javascript.js" are downloaded from the server in the first web page request, be cached, and subsequent requests use the cached version of the file in the client, thereby increasing the speed of the page, not being necessary download server again.

NETWORK

The files listed below this tag, will not be cached, and always have to download from the server on each request.

A typical file of this type could be a LOGIN page a user to enter the system.

FallBack

The files listed below this tag specifies the file to be loaded OFFLINE if the Internet connection is not available for a given server path.

FallBack example:

FALLBACK /tutorialHTML5/ /offlineHTML5.html /tutorialSQL/ /offlineSQL.html

No connection to Internet, when I request a page from the path "tutorialHTML5" then be loaded by default the page "offlineHTML5.html".

No connection to Internet, when I request a page from the path "tutorialSQL" will load the default page "offlineSQL.html"