除非清除缓存,否则 Google chrome css 不会更新
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20300400/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Google chrome css doesn't update unless clear cache
提问by Marchy
I'm trying to work in my local server but I have to clear my cache every time if I want to see changes on the css rules.
我正在尝试在我的本地服务器上工作,但是如果我想查看 css 规则的变化,我必须每次都清除我的缓存。
There is any way to control Google Chrome cache?
有什么办法可以控制谷歌浏览器的缓存?
回答by Vitalii Petrychuk
- Open
DevTools
- Open
Settings
(bottom right or useF1
shortcut) - Check
Disable cache (while DevTools is open)
- 打开
DevTools
- 打开
Settings
(右下角或使用F1
快捷方式) - 查看
Disable cache (while DevTools is open)
https://developers.google.com/chrome-developer-tools/docs/settings#general
https://developers.google.com/chrome-developer-tools/docs/settings#general
回答by Julien F.
CTRL+F5 : to refresh the page by clearing GG chrome cache.
CTRL+F5 : 通过清除 GG chrome 缓存来刷新页面。
回答by JGallardo
- Open up your Developer Toolsthen click the icon on the top right
- 打开你的开发者工具,然后点击右上角的图标
- In settings --> preferences scroll down to find "Disable cache (while DevTools is open)" and click on the box to select the option.
- 在设置 --> 首选项中向下滚动以找到“禁用缓存(DevTools 打开时)”,然后单击该框以选择该选项。
If you are still having the problem, and the page works on other browsers, then the easy fix could be to just uninstall Google Chrome and do a fresh install of the latest version. I ran into this problem and it was the best fix instead of the headache of tracking down a complicated fix or outdated posts that no longer work. After you have Chrome reinstalled, repeat the steps above to disable cache.
如果您仍然遇到问题,并且该页面可以在其他浏览器上运行,那么简单的解决方法可能是卸载 Google Chrome 并重新安装最新版本。我遇到了这个问题,这是最好的解决方案,而不是追踪复杂的修复程序或不再有效的过时帖子的头痛。重新安装 Chrome 后,重复上述步骤以禁用缓存。
回答by sachinjain024
You can do any of the following options:-
您可以执行以下任何选项:-
- Install a Chrome Extensionlike Clear Cache to clear cache by clicking on icon.
- Use Incognito Modeand browser your website in incognito mode. Incognito mode won't disable cache clearly. Disabling cache completely may slow down your browsing experience.
- Use chrome's features like Hard Reload (Clear cache and hard reload). Read this stackoverflow post
- As @Vitaly mentioned, Use Developer Tool settings to disable cache completely.
- 安装一个像清除缓存这样的Chrome 扩展程序,通过点击图标来清除缓存。
- 使用隐身模式并以隐身模式浏览您的网站。隐身模式不会清楚地禁用缓存。完全禁用缓存可能会降低您的浏览体验。
- 使用 chrome 的功能,如 Hard Reload(清除缓存和硬重新加载)。阅读这篇stackoverflow帖子
- 正如@Vitaly 提到的,使用开发人员工具设置完全禁用缓存。
Choose what fits you :)
选择适合你的:)
回答by pcodex
Shift-F5 to reload the page worked for me on Chrome 61.0.3163.100
Shift-F5 重新加载页面在 Chrome 61.0.3163.100 上对我有用
回答by Kendevman
More tools > Developer Tools
Then right click the refresh button on the browser.
You will get three options. Select "Empty Cache and Hard Reload".
更多工具 > 开发者工具
然后右击浏览器上的刷新按钮。
您将获得三个选项。选择“清空缓存和硬重新加载”。
This will only impact the active tab.
这只会影响活动选项卡。
回答by SylvainB2347
Following this solution here helped me reloading the css : https://wpreset.com/force-reload-cached-css/
按照这里的解决方案帮助我重新加载 css:https: //wpreset.com/force-reload-cached-css/
Instead of requesting the file doing the following :
而不是请求文件执行以下操作:
<link rel="stylesheet" href="~/css/variabledocument.css" type="text/css" />
Request id by adding a parameter (the name of the parameter doesn't matter) at the end of the file :
通过在文件末尾添加参数(参数的名称无关紧要)来请求 id :
<link rel="stylesheet" href="~/css/variabledocument.css?refreshcss=1" type="text/css" />
This will request the new css file. Whenever you make a change to your css file, you just have to change either the parameter name, value or both and the server will request it again.
这将请求新的 css 文件。每当您更改 css 文件时,您只需更改参数名称、值或两者,服务器将再次请求它。
This is very useful when you have no control over the browsers of your clients and it requests no action on their part.
当您无法控制客户端的浏览器并且不要求他们采取任何行动时,这非常有用。
回答by Asep Saepuloh
- Disable cache (while DevTools is open)
- Close Chrome Browser
- Clear Cache with Software CC Cleaner
- After that Open Chrome browser
- 禁用缓存(当 DevTools 打开时)
- 关闭 Chrome 浏览器
- 使用软件 CC Cleaner 清除缓存
- 之后打开Chrome浏览器