Html5使用学习
目录
1、方式js文件被浏览器缓存
<script>document.write("<script src='y.js?v=" + Date.now() + "'></script>");</script>
<script type="text/javascript"> (function(){ var randomh=Math.random(); var e = document.getElementsByTagName("script")[0]; var d = document.createElement("script"); d.src = "y.js?x="+randomh+""; d.type = "text/javascript"; d.async = true; d.defer = true; e.parentNode.insertBefore(d,e); })(); </script>
思路就是给js文件路径追加随机字符串