[英]How to check if a particular resource (e.g. image) is cached by the browser?
I have a resource that is served with Cache-Control: public, immutable
, ie I expect the resource to exist in the browser's cache for non-first time visitors. 我有一个与
Cache-Control: public, immutable
一起使用的资源Cache-Control: public, immutable
,即我希望该资源对于非首次访问者而言存在于浏览器的缓存中。
(Browser support for "immutable" configuration is off-topic.) (浏览器对“不可变”配置的支持不在主题之列。)
How to check if a particular resource (eg image) is cached by the browser without triggering browser to load the resource? 如何在不触发浏览器加载资源的情况下检查浏览器是否缓存了特定资源(例如图像)?
I don't know if there is a way to do this from within code. 我不知道是否有办法从代码中做到这一点。 But if you just want to check if a resource is loaded from cache you can check developer tools like @Yani suggested in comments.
但是,如果您只想检查是否从缓存中加载了资源,则可以检查注释中建议的开发人员工具,例如@Yani。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.