Implementing HTML5 Application Cache.
💻 coding

Implementing HTML5 Application Cache.

1 min read 228 words
1 min read
ShareWhatsAppPost on X
  • 1HTML5 application cache allows for offline web projects, enhancing user experience by reducing server load and increasing page speed.
  • 2The manifest file includes three sections: CACHE MANIFEST for cached files, NETWORK for required internet resources, and FALLBACK for offline pages.
  • 3To ensure proper server support for .appcache files, add the directive 'AddType text/cache-manifest .appcache' in the .htaccess file.

AI-generated summary · May not capture all nuances

Key Insight
AskGif

"HTML5 application cache allows for offline web projects, enhancing user experience by reducing server load and increasing page speed."

Implementing HTML5 Application Cache.

Are you working with HTML5, then take a quick look at this post that explains how to develop an offline web project using HTML5 application cache. Most of the latest browsers have caching mechanisms, this gives three advantages reducing server load, increases web page speed and office access specially for a gaming website.

Manifest File

The manifest file contains three parts CACHE MANIFEST, NETWORK, and FALLBACK. You can create this simple text file using notepad with extension filename.appcache

CACHE MANIFEST

List all the files what exactly you want to be cached under the browser manifest.

CACHE MANIFEST
index.html
style.css
logo.png

NETWORK

Sometimes the webpage strongly required internet access to call APIs, in such a case we need to keep resource URLs under this header.

Chrome
NETWORK:
*

Firefox needs arbitrary urls instead of asterisk (*)
NETWORK:
http:// * , https:// *

FALLBACK

If you want to display some special no internet page like 404, keep the file or URL under this header.

FALLBACK:
/ no-internet.html

mainfest.appcache

CACHE MANIFEST
index.html
style.css
logo.png

FALLBACK:
/ no-internet.html

NETWORK:
*

.htaccess

Few servers are not supporting .appcache file type extension, include this file for better result.

AddType text/cache-manifest .appcache

index.html

Include mainfest.appcache

<!doctype html>
<html manifest="mainfest.appcache">
<head>
<title>Your Page Title</title>
<link href="style.css" rel="stylesheet" type="text/css" /> 
</head>
<body>
<div><img src="logo.png" /></div>
<a href="file.php">Required Internet Access</a>
</body>
</html>

Application Cache Clear in Chrome

chrome://appcache-internals/

Enjoyed this article?

Share it with someone who'd find it useful.

ShareWhatsAppPost on X

AskGif

Published on 29 August 2019 · 1 min read · 228 words

Part of AskGif Blog · coding

You might also like

Implementing HTML5 Application Cache. | AskGif Blog