The manifest attribute for the html tag

The manifest attribute of the html tag sets the URL of the document with the location of the manifest file. It stores data about the resources that need to be loaded into the cache to be able to work offline.

The HTML5 specification includes an application cache – the ability for a web application to work without an internet connection. The first time a web page or application is opened, data is loaded and saved for further work and the ability to display it offline.

The manifest attribute value is determined by specifying an absolute or relative path to the manifest text file.

<html manifest="URL address">
URL Absolute – “”
Relative – “/user/inc/work.cache”

The manifest is represented as an ordinary text file in the form of a list of resources that must be cached by the browser for offline work of the application.

# 2021-10-01:v5

# Resource Caching

# Caching 'master data'

# Resources that require the user to be online

# static-page.html will be served if is unavailable
# offline.png will be served in place of all images in images /
# offline-page.html will be served in place of all other .html files
/ /static-page.html
*.html /offline-page.html

Using a cache allows you to take advantage of:

  • Offline operation – the ability to use the application without an internet connection.
  • Speed – more fast loading resources with cache.
  • Reducing server load – only new or changed content will be loaded in the browser.

This attribute (manifest) must be written on those pages of the web-application that need to be cached.

<!DOCTYPE html>
<html manifest="/user/inc/work.cache"> <!-- The address of the manifest with a list of resources that should be cached -->
  <meta charset="utf-8">
  <div class="n1234">
   <canvas id="app" width="500" height="500">
     <img src="images/num.png" alt="">
   <h3>Application description</h3>

You need to understand what data you are caching. After loading a file into the cache, the browser will show the cached data, even if it is changed on the server. To update it in the browser (cache) you need to change the manifest file itself.

The cache can be reloaded by the following changes:

  • Updating the cache programmatically.
  • Making changes to the manifest file.
  • Clearing the cache by the user.
  • Filling the allocated memory for the application on the user’s device.

Also different browsers may have their own limitations on the size of the cached data.

The manifest attribute appeared only in HTML5, previous versions do not support it.

Leave a Comment

Your email address will not be published.