简体   繁体   English

随时在加载网站时清除缓存浏览器

[英]Clear cache browser while loading website at any time

When the website goes live from local we have to press F5 to reload the web page.当网站从本地上线时,我们必须按F5重新加载网页。 Can we give idea to clear cache while loading website?我们可以在加载网站时提出清除缓存的想法吗? Is there any jQuery or JavaScript for hard refreshing a website?是否有任何用于硬刷新网站的 jQuery 或 JavaScript?

Look into the cache-control and the expires META Tag.查看缓存控制和过期 META 标记。

Another common practices is to append constantly-changing strings to the end of the requested files.另一种常见做法是将不断变化的字符串附加到请求文件的末尾。 For instance:例如:

<script type="text/javascript" src="main.js?v=12392823"></script>

Another Example 另一个例子

Use:使用:

location.reload(true);

This will reload the page from the server.这将从服务器重新加载页面。 Do your research!做你的研究! ( Javascript hard refresh of current page ). 当前页面的 Javascript 硬刷新)。

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

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