Home  >  Article  >  Web Front-end  >  H5 application cache-Manifest specific introduction

H5 application cache-Manifest specific introduction

黄舟
黄舟Original
2017-04-18 09:55:591827browse

Introduction

Manifest is an application provided by H5Cache Mechanism, based on which web applications can achieve offline access (offline cache). To this end, the browser also provides an application cache API--applicationCache. Although the manifest technology has been abandoned by web standards, this does not affect our attempt to understand it. . It is precisely because the application caching mechanism of manifest is so attractive that Ele.me and office 365 mailboxes are still using it!

Description

Students who are familiar with manifest can skip it This section.

In view of the manifest application caching technology, we can achieve:

Offline access: Even if the server is down or there is no network, users can still browse web content normally.

Faster access: The data exists locally, saving the time for the browser to initiate an http request, so the access is faster, and the effect on the mobile terminal is more obvious.

Reduce load: The browser only displays in the manifest file Only when changes are made will the server download the resources that need to be cached, which greatly reduces the server load.

The process of manifest caching is as follows (from the Internet):

Supportability

Mainstream browsers All support manifest application caching technology. The following table:

H5 application cache-Manifest specific introduction

In the H5 standard, the Offline Web applications part has the following description:

This feature is in the process of being removed from the Web platform. 
(This is a long process that takes many years.) 
Using any of the offline Web application features at this time is highly discouraged. Use service workers instead. [SW]

So I will follow up on other The article continues to introduce service workers. This article continues to focus on the manifest.

How to enable application caching

The manifest is managed using the cache manifest. The cache manifest needs to be associated with the html tag . As follows:

<html manifest="test.appcache">
  ...
</html>

Specifying the manifest file in the html tag means that the webpage uses the manifest for offline caching. The list of files that need to be cached in the webpage needs to be specified in the test.appcache text file.

manifest cache list

Just like writing an article, the manifest adopts the classic three-stage structure. They are: CACHE, NETWORK and FALLBACK. As follows, let’s take a look at a chestnut first.

The above is the detailed content of H5 application cache-Manifest specific introduction. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn