Web移动端使用localStorage缓存Js和css文件 | 强制不要缓存

1.尽量不把js放在onload事件中,而是放在由用户主动触发的事件
2.加时间戳,时间不同则会加载js而非使用缓存

强制不要缓存:
<meta http-equiv=Cache-Control content=no-cache /> 
必须结合其他:
<!-- 禁止浏览器从本地缓存中调阅页面。--> 
<meta http-equiv="pragram" content="no-cache"> 
<!--网页不保存在缓存中,每次访问都刷新页面。--> 
<meta http-equiv="cache-control" content="no-cache, must-revalidate"> 
<!--同上面意思差不多,必须重新加载页面--> 
<meta http-equiv="expires" content="0"> 
<!--网页在缓存中的过期时间为0,一旦网页过期,必须从服务器上重新订阅--> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
原文地址:https://www.cnblogs.com/zyjzz/p/6973608.html