首页 > 代码库 > 禁止浏览器缓存js

禁止浏览器缓存js

方法:在js文件后加上数学随机数;

Math.random()

比如:源代码为

<script src="./js/lib/require/require.js" data-main="./js/modules/main/main"></script>

修改之后变成:

<script>
        document.write(<script src="http://www.mamicode.com/js/lib/require/require.js" +  data-main=\"./js/modules/main/main.js?rnd= + Math.random() + "\"" + ><\/script>);
</script>

 

禁止浏览器缓存js