Home > Web Front-end > H5 Tutorial > How to cancel cache in WeChat browser

How to cancel cache in WeChat browser

PHPz
Release: 2018-09-29 11:54:25
Original
3430 people have browsed it

This article mainly introduces the method of canceling the cache of WeChat browser. This article uses meta header information to cancel the cache of WeChat browser. It is especially used frequently during development. Friends in need can refer to it.

When creating a WeChat public account and debugging mobile pages, it is inevitable that the page will jump to the WeChat browser to open. During the debugging phase, the Android version of WeChat browser always caches html static resources by default, every time the static resources change. Even when new content is released, it is very likely that it will not be updated on the WeChat browser. In many cases, you have to clear the WeChat cache to see the effect, which is very annoying. Some customers have installed QQ Browser, and WeChat actually calls QQ Browser. Sometimes even clearing the WeChat cache is ineffective, and the QQ Browser cache must also be cleared.

After some exploration, the WeChat browser does indeed cache on the upper layer of the webview: that is, if this address is requested, it will be stored locally and will not be retrieved online later.

The solution is to add the following header information during the debugging phase or frequently updated pages

The code is as follows:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
Copy after login

Well, in this way, the WeChat browser will treat this page It has been pulled online.

The above is the entire content of this chapter. For more related tutorials, please visit Html5 video tutorial!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template