简体   繁体   English

修改head.js javascript调用后强制刷新缓存?

[英]Forcing cache refresh after modifying head.js javascript calls?

I am using head.js and using the below file to initiate the javascript file calls: 我正在使用head.js并使用以下文件启动javascript文件调用:

 <script src="/scripts/load.js" type="text/javascript"></script>

In the load.js file I have the following code: 在load.js文件中,我有以下代码:

head.js(

   {livechat: "/scripts/livechat.js"},
   {jquery: "http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"},
   {jquerytools: "http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js"},
   {slider: "/scripts/jquery.nivo.slider.pack.js"},
   {prettyphoto: "/scripts/jquery.prettyPhoto.js"},
   {sliderfunctions: "/scripts/slidercode.js"},
   {functions: "/scripts/functions.js"}

);

My problem is, even though I removed the livechat line, the chat box is still appearing on all my website pages unless I manually clear the browser cache. 我的问题是,即使我删除了实时聊天行,但除非手动清除浏览器缓存,否则聊天框仍会出现在我的所有网站页面上。 My concern is that I no longer utilize the livechat service and I do not want the visitors to be confused by seeing the livechat box appear but not function correctly. 我担心的是,我不再使用实时聊天服务,并且我不希望看到实时聊天框出现但功能无法正常使访问者感到困惑。

Is there any way to tell head.js that there has been a change in the files being loaded and to refresh browser cache or something? 有没有办法告诉head.js所加载的文件发生了变化并刷新浏览器缓存或其他内容?

You could put something along the lines of this: 您可以按照以下方式进行操作:

<script src="/scripts/load.js?date=123456789" type="text/javascript"></script>

Adding a query string to this file should trick the browser into thinking it's something it hasn't seen before. 向该文件添加查询字符串应该会使浏览器误以为它是以前从未见过的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM