HTML5 App Cache- Speed Up your Website

0
18

Image

 

Websites we offen visits have elements of notable size which downloads each time when we visit and this may cost us or atleast will cost us in terms of time. To avoid this cache may be a better solution

What Caching do.

Caching do cache files for later reference and for the reason that it is fetching locally it will be much faster, caching can be customized in many ways like which files need to be cached, which to be skipped and which to be shown when server is down etc

To enable application cache, include the manifest attribute in the document’s <html> tag:

<!DOCTYPE HTML>
<html manifest=”cache.appcache”>
<some code here>
</html>

The manifest file has three sections:

CACHE MANIFEST – listed under this header only will be cached after first visit

NETWORK – Under this will allways be fetched from network,ie. Will not be cached

FALLBACK – Fallbacks ,if inaccessible load from cache

look at a sample cache file

CACHE MANIFEST
/my_logo.gif

NETWORK:
checkpassword.asp

FALLBACK:
/user/ /notavailable.html

Here file my_logo.gif will be cached and will not load from network again

checkpassword.asp will not be cached and there by no local load for this file. This is why asp files may need continuous updations day by day and is not advaised to save locally ( PHP,JSP etc too)

FALLBACK specifies when url /user is not accessible /notavailable.html will be loaded to avoid default browser error ( Eg. Google )

LEAVE A REPLY

Please enter your comment!
Please enter your name here