当前位置:网站首页>微信内置浏览器禁止缓存的问题
微信内置浏览器禁止缓存的问题
2022-07-29 05:20:00 【Denny辉】
解决方案1:
调试阶段或者频繁更新的页面加入以下头信息:
<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" />
解决方案2:
更新文件的时候,在引用css,js等文件的语句上加上一个版本号,就能有效防止浏览器一直使用缓存中的css,js
<link href="css/demo.css?v=201606131149" rel="stylesheet">
解决方案3:
防止页面被缓存的方法,在URL后面添加随机参数,这样每次访问的都是不同的连接
window.location='xxx.html?_r='+Math.random();
终极方案:
页面动态引入js文件:
//防止js文件缓存。
var now = new Date();
var number = now.getYear().toString() + now.getMonth().toString() + now.getDate().toString() + now.getHours().toString() + now.getMinutes().toString() + now.getSeconds().toString();
document.write('<scr' + 'ipt type="text/javascript" src="internal-scripts/js/BUdas-public.js?v='+number+'"></scr' + 'ipt>');
document.write('<scr' + 'ipt type="text/javascript" src="internal-scripts/js/BUdas-request.js?v='+number+'"></scr' + 'ipt>');
document.write('<scr' + 'ipt type="text/javascript" src="internal-scripts/js/BUdas-chart.js?v='+number+'"></scr' + 'ipt>');
document.write('<scr' + 'ipt type="text/javascript" src="internal-scripts/js/BUdas-report.js?v='+number+'"></scr' + 'ipt>');
更多文章请扫描关注公众号:
边栏推荐
- Elastic box flex
- 一文读懂Move2Earn项目——MOVE
- Fantom (FTM) prices will soar by 20% in the next few days
- Sports health is deeply rooted in the hearts of the people, and move protocol leads quality life
- Seay源代码审计系统
- Qtcreator+cmake compiler settings
- Set the background color of a cell in the table
- MOVE PROTOCOL全球健康宣言,将健康运动进行到底
- [typescript] in depth study of typescript functions
- 与开源项目同步开发& CodeReview & Pull Request & fork怎么拉取原始仓库
猜你喜欢
随机推荐
Win10 compiles ffmpeg (including ffplay)
与开源项目同步开发& CodeReview & Pull Request & fork怎么拉取原始仓库
Some opportunities for young people in rural brand building
焕然一新,swagger UI 主题更改
“山东大学移动互联网开发技术教学网站建设”项目实训日志一
Merge the same items in the same column in table
Crypto巨头们ALL IN元宇宙,PlatoFarm或能突围
Selection options of uniapp components (such as package selection)
What is sqlmap and how to use it
新手入门:手把手从PHP环境到ThinkPHP6框架下载
Elastic box flex
Move protocol global health declaration, carry out the health campaign to the end
Qtcreator+cmake compiler settings
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
山寨币SHIB 在 ETH 鲸鱼的投资组合中拥有 5.486 亿美元的股份——交易者应提防……
Fantom (FTM) surged 45% before the FOMC meeting
What is wapiti and how to use it
Novice introduction: download from PHP environment to thinkphp6 framework by hand
H5 semantic label
[typescript] type reduction (including type protection) and type predicate in typescript




![[typescript] learn typescript object types in depth](/img/87/a9fd2f177331863e06fcf14559eeed.png)




