You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何阻止Chrome缓存图片?能否对Chrome缓存策略进行精细化调整?

Controlling Chrome's Image Caching: Disable & Fine-Tune Rules

Hey there! Let's walk through exactly how to block Chrome from caching images, plus how to tweak those caching rules to fit your specific needs—whether that's targeting file types, size thresholds, or specific sites.


1. Completely Block Chrome from Caching Images

If you want a blanket ban on image caching, here are a couple of reliable ways:

Temporary Debugging Solution (DevTools)

Perfect for when you're testing a website and need fresh images every load:

  • Open Chrome DevTools (press F12 or Ctrl+Shift+I/Cmd+Opt+I)
  • Go to the Network tab
  • Check the box at the top labeled "Disable cache (while DevTools is open)"

Note: This only works as long as DevTools stays open—close it, and caching goes back to normal.

Permanent (or Semi-Permanent) Solution: Command Line Flags

If you want Chrome to always skip image caching, launch it with these command line parameters:

  • Right-click your Chrome shortcut, go to Properties
  • In the "Target" field, add these flags at the end (make sure there's a space before the first dash):
    --disk-cache-size=1 --media-cache-size=1
    
  • Click "Apply" and restart Chrome. This sets the disk and media cache sizes to 1 byte, effectively disabling them.

2. Fine-Tuning Chrome's Caching Rules

Chrome's native settings don't offer super granular control out of the box, but extensions let you customize exactly how caching works. Here's how to handle each of your requests:

Block Caching for Specific File Types

Use a rule-based extension like Requestly or Cache Killer to target specific image formats:

  • Install the extension from the Chrome Web Store
  • Create a new rule that matches URLs ending with your target file types (e.g., .jpg, .png, .webp, .svg)
  • Set the rule to modify the response headers: add Cache-Control: no-store or Pragma: no-cache to force Chrome not to cache those files.

Skip Caching for Files Above a Size Threshold

Again, extensions are your best bet here—Requestly supports this natively:

  • Create a new "Modify Headers" rule
  • Set the trigger to match image files (using file type filters as above)
  • Add an additional condition: "Response Size > [your threshold]" (e.g., 1048576 bytes for 1MB)
  • Configure the rule to override cache headers for these large files, preventing Chrome from storing them.

Exclude Image Caching for Specific Sites

To disable caching only on certain websites:

  • Use Requestly to create a rule targeted at specific domains (e.g., *.example.com)
  • Narrow the rule to only apply to image resources (use file type filters)
  • Set the cache header override to no-store—this way, Chrome will always fetch fresh images from that site, but keep caching enabled for others.

Quick Notes

  • Extensions like Requestly give you tons of flexibility—you can mix and match rules (e.g., block large PNGs on Site A, but cache all images on Site B)
  • Command line flags are great if you want a system-wide, no-fuss disable, but they don't let you pick and choose.

Hope these tips help you get exactly the caching behavior you want!

内容的提问来源于stack exchange,提问作者greektranslator

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 09:07:38