问题描述
如果我在CSS中的一条规则中将缓存清除器添加到图片网址
If I add a cache buster to an image URL in one rule in my CSS
background: url(../img/sprite.png?version=20130205) no-repeat -75px -208px;
但同一CSS具有URL的其他版本,而没有缓存无效符
but the same CSS has other versions of the URL without the cache buster
background: url(../img/sprite.png) no-repeat 0 0;
是否会引起对sprite.png的另一个请求?
does that cause another request for sprite.png?
另外,如果浏览器首先解析了未缓存的URL,那么我会假定它显示了缓存的图像(如果有的话),但是当涉及到缓存无效的版本时,它将请求该图像的新版本-我说对了吗?
Also if the browser parses the non-cache-busted URL first I'd assume it shows the cached image, if it has one, but will then request a new version of the image when it comes to the cache busted version - have I got it right?
推荐答案
是的,它将导致对图像的新请求.如果它是?
,则将重新加载图像.
Yes it will cause a new request for the image. If it is ?
the image will reload.
如果您不想发出新请求,请在示例中使用#
If you don't want to make new request use #
in example
background: url(../img/sprite.png#version=20130205) no-repeat -75px -208px;
这篇关于CSS中图像URL上的缓存中断是否会引起额外的请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!