Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
694 views
in Technique[技术] by (71.8m points)

google-chrome - 禁用Chrome缓存进行网站开发(Disabling Chrome cache for website development)

I am modifying a site's appearance (CSS modifications) but can't see the result on Chrome because of annoying persistent cache.

(我正在修改网站的外观(修改CSS),但是由于烦人的持久性缓存,在Chrome上看不到结果。)

I tried Shift +refresh but it doesn't work.

(我尝试了Shift +刷新,但是没有用。)

How can I disable the cache temporarily or refresh the page in some way that I could see the changes?

(如何临时禁用缓存或以可以看到更改的某种方式刷新页面?)

  ask by tomermes translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The Chrome DevTools can disable the cache.

(Chrome DevTools可以禁用缓存。)

  1. Right-click and choose Inspect Element to open the DevTools.

    (右键单击并选择Inspect Element以打开DevTools。)

    Or use one of the following keyboard shortcuts :

    (或使用以下键盘快捷键之一 :)

    • F12

      (F12)

    • Command + Option + i on Mac

      (Mac上的Command + Option + i)

    • Control + Shift + i on Windows or Linux

      (Windows或Linux上的Control + Shift + i)

  2. Click Network in the toolbar to open the network pane.

    (点击 Network工具栏中打开网络窗格。)

  3. Check the Disable cache checkbox at the top.

    (选中顶部的Disable cache复选框。)

开发工具面板的屏幕截图

Keep in mind, as a tweet from @ChromiumDev stated, this setting is only active while the devtools are open .

(请记住,正如@ChromiumDev的一条推文所述,此设置仅在devtools打开时才有效 。)

Note that this will result in all resources being reloaded.

(请注意,这将导致重新加载所有资源。)

Should you desire to disable the cache only for some resources, you can modify the HTTP header that your server sends alongside your files.

(如果只希望对某些资源禁用缓存,则可以修改服务器与文件一起发送的HTTP标头 。)

If you do not want to use the Disable cache checkbox, a long press on the refresh button with the DevTools open will show a menu with the options to Hard Reload or Empty Cache and Hard Reload which should have a similar effect.

(如果您不想使用“ Disable cache复选框,则在打开DevTools的情况下长按刷新按钮将显示一个菜单,其中包含“ Hard Reload或“ Empty Cache and Hard Reload ,应该会产生类似的效果。)

Read about the difference between the options .

(了解选项之间的区别 。)

The following shortcuts are available:

(可以使用以下快捷方式:)

  • Command + Option + R on Mac

    (在Mac上为Command + Option + R)

  • Control + Shift + R on Windows or Linux

    (Windows或Linux上的Control + Shift + R)

长按


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...