WeChat built-in browser always caches web page content

October 29, 2023 427 point heat 1 person likes 0 comments

1. Add version number information to static resources referenced by the page

For example, the old xx. js? Version=1.0 New xx. js? version=2.0

2. Add the following head to the html header of the page

 < meta http - equiv = "cache-control" content = "max-age=0"  / >
 < meta http - equiv = "cache-control" content = "no-cache"  / >
 < meta http - equiv = "expires" content = "0"  / >
 < meta http - equiv = "expires" content = "Tue, 01 Jan 1970 1:00:00 GMT"  / >
 < meta http - equiv = "pragma" content = "no-cache"  / >

3. If there is nginx, directly add the header to tell the browser not to cache
add_header Cache-Control no-cache;
add_header Cache-Control private;

 

Gcod

If life is just like the first sight, what is the sad autumn wind painting fan

Article comments