强制浏览器清除缓存

编程入门 行业动态 更新时间:2024-10-24 06:29:51
本文介绍了强制浏览器清除缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有一种方法,我可以把一些code我的网页上,所以当有人访问一个网站,它清除浏览器缓存,这样他们就可以查看更改?

Is there a way I can put some code on my page so when someone visits a site, it clears the browser cache, so they can view the changes?

使用的语言:ASP.NET,VB.NET,当然HTML,CSS和jQuery

Languages used: ASP.NET, VB.NET, and of course html, css, and jquery.

推荐答案

如果这是关于的.css 和的.js 的变化,一种方法是,以缓存无效被追加类似 _versionNo 为每个版本的文件名。例如:

If this is about .css and .js changes, one way is to to "cache busting" is by appending something like "_versionNo" to the file name for each release. For example:

script_1.0.css // This is the URL for release 1.0 script_1.1.css // This is the URL for release 1.1 script_1.2.css // etc.

或文件名之后交替做到这一点:

Or alternatively do it after the file name:

script.css?v=1.0 // This is the URL for release 1.0 script.css?v=1.1 // This is the URL for release 1.1 script.css?v=1.2 // etc.

您可以看看这个链接来看看它是如何可以工作。

You can check out this link to see how it could work.

更多推荐

强制浏览器清除缓存

本文发布于:2023-10-31 19:06:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547002.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓存   浏览器

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!