强制刷新浏览器CSS,JavaScript的,等 [英] Force browser to refresh css, javascript, etc

查看:1322
本文介绍了强制刷新浏览器CSS,JavaScript的,等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发通过XAMPP基于字preSS源$ C ​​$ C网站。有时我更改CSS code,scrips或别的东西,我发现我的浏览器需要时间来应用修改。这使我使用多个浏览器刷新之一,如果不适用新的样式我尝试第二个,它总是这一点。

I'm developing a website based on Wordpress source code through XAMPP. Sometimes I change the CSS code, scrips or something else and I notice my browser takes time to apply the modifications. This leads me to use multiple browsers to refresh one and if doesn't apply the new styles I try the second one and it's always this.

有是避免这种问题的一些方法?
有时候,我改变了code,恕不另行通知previous修改。

There is some way of avoiding this problem? Sometimes I'm changing code without notice the previous modifications.

推荐答案

pressing <大骨节病>控制 + <大骨节病> F5 (或<大骨节病>控制 + <大骨节病>移 + <大骨节病>研究)来强制缓存重新加载。我相信Mac上使用<大骨节病> Cmd的 + <大骨节病>移 + <大骨节病>研究

General solution

Pressing Ctrl + F5 (or Ctrl + Shift + R) to force a cache reload. I believe Macs use Cmd + Shift + R.

在PHP中,你可以通过过去与头的到期日期设置为一个时间禁用缓存:

In PHP, you can disable the cache by setting the expiration date to a time in the past with headers:

header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

Chrome的高速缓存可以通过开放的开发工具被禁用<大骨节病> F12 ,点击在右下角的齿轮图标,然后在设置对话框中选择禁用缓存,就像这样:

Chrome

Chrome's cache can be disabled by opening the developer tools with F12, clicking on the gear icon in the lower right corner and selecting Disable cache in the settings dialog, like this:

结果
图像从<一个取href=\"http://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development\">this回答。

键入 about:config中在URL栏中然后找到标题为条目 network.http.use缓存。将其设置为

Type about:config into the URL bar then find the entry titled network.http.use-cache. Set this to false.

这篇关于强制刷新浏览器CSS,JavaScript的,等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆