当前位置:网站首页>微信内置浏览器禁止缓存的问题
微信内置浏览器禁止缓存的问题
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>');
更多文章请扫描关注公众号:
边栏推荐
- “山东大学移动互联网开发技术教学网站建设”项目实训日志二
- CMD window under Windows connects to MySQL and operates the table
- Seay source code audit system
- 如何零代码制作深度学习的趣味app(适合新手)
- Solve the problem that the prompt information of form verification does not disappear and the assignment does not take effect
- Wechat applet change attribute value -setdata- bidirectional binding -model
- QT layout management -- Part stretch principle and sizepolicy
- Extreme deflation and perpetual motion machine model will promote the outbreak of platofarm
- Go|Gin 快速使用Swagger
- 如何在加密市场熊市中生存?
猜你喜欢
[JS question solution] questions 1-10 in JS of niuke.com
量化开发必掌握的30个知识点【什么是分笔逐笔数据】?
[typescript] type reduction (including type protection) and type predicate in typescript
裸金属云FASS高性能弹性块存储解决方案
QT setting background image method
How to survive in the bear market of encryption market?
Read and understand move2earn project - move
运动健康深入人心,MOVE PROTOCOL引领品质生活
Okaleido tiger logged into binance NFT on July 27, and has achieved good results in the first round
DAY13:文件上传漏洞
随机推荐
H5 semantic label
Gluster集群管理小分析
华为2020校招笔试编程题 看这篇就够了(下)
Hcia-r & s self use notes (25) NAT technical background, NAT type and configuration
Qt设置背景图片方法
记xx公司SQL注入漏洞
Wapiti是什么以及使用教程
麦当娜“Hellbent”购买130万美元的nft无聊猿,现在被认为太贵了
农村品牌建设给年轻人的一些机会
Fantom (FTM) 在 FOMC会议之前飙升 45%
Windows下cmd窗口连接mysql并操作表
QT layout management -- Part stretch principle and sizepolicy
Masscan tutorial
完全去中心化的编程模式,不需要服务器,也不需要ip,就像一张漫无目的的网络、四处延伸
焕然一新,swagger UI 主题更改
使用Qss设置窗体样式
一文读懂Move2Earn项目——MOVE
机器学习让文字识别更简单:Kotlin+MVVM+华为ML Kit
DAY4:MySQL 数据库的建立及简单实用
Common characteristic engineering operations