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" />
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!