防止将JavaScript缓存在浏览器中 [英] Prevent javascript from being cached in browser
本文介绍了防止将JavaScript缓存在浏览器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在开发一个Web应用程序,并且对Javascript进行了相当频繁的修订.但是,只有手动刷新浏览器缓存后,更改才会发生.有没有一种方法可以通过Chrome代码自动实现缓存刷新?谢谢.
I'm currently working on a webapp and the Javascript is revised fairly often. However, the changes don't occur until the browser cache is refreshed manually. Is there a way to implement cache-refreshing automatically through code for Chrome? Thanks.
推荐答案
您可以将?2352352
之类的内容放在JS文件的末尾.所以像
You can put something like ?2352352
at the end of your JS file. So something like
<script src='myfile.js?20457207'></script>
数字是随机的,迫使浏览器认为它是不同的文件.
Where the number randomizes, forcing the browser to think it's a different file.
这篇关于防止将JavaScript缓存在浏览器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文