Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use HTML5 offline cache Manifest

Shulou Source: shulou.com Published: 2022-06-01 11:10:02 10月02日 Update

This article focuses on "how to use HTML5 offline cache Manifest". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use HTML5 offline cache Manifest.

What is manifest?

To put it simply, manifest allows your application to be accessed without a net.

It has three major advantages:

1. Offline browsing, which can be accessed normally without Internet.

2. Faster loading speed, faster local access speed of cache

3. Reduce the pressure of service request. There is no need to request again after the file is cached, only the file that needs to be updated.

How to use it?

XML/HTML Code copies content to the clipboard

...

You need to include the manifest attribute in every page of the web app you want to cache. If a page does not have a manifest attribute, it will not be cached (unless the page is explicitly specified in the manifest file). This means that as long as the page visited by the user contains the manifest attribute, it will be added to the application cache. This eliminates the need to specify which pages need to be cached in the manifest file.

The Manifest attribute can specify either an absolute URL or a relative path, but an absolute URL needs to be homologous to web app. A manifest file can be any extended file type, but it must have the correct mime-type, such as adding to Apache

"AddType text/cache-manifest .appcache".

Manifest file

A manifest file is a simple text file that tells the browser what is cached (and what is not cached).

The manifest file can be divided into three parts:

CACHE MANIFEST-the files listed under this heading will be cached after the first download

NETWORK-the files listed under this heading require a connection to the server and will not be cached

FALLBACK-the file listed under this heading specifies the fallback page (such as 404 page) if the page is inaccessible.

At this point, I believe you have a deeper understanding of "how to use HTML5 offline cache Manifest". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: File cache page content properties title situation faster faster learning service browsing practical deeper three three no middle finger advantage interest Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL macOS OPPO Reno Huawei