2

If I am using background: url in my CSS files like:

background: url("/app/assets/imgs/someimage.png") no-repeat !important;

Is the image will load from my cache(assuming it is there), or it will send a new request for it?

I have checked chrome://cache/ and the image exists.

3
  • It will be in cache if your css stays in cache Commented Oct 18, 2016 at 13:19
  • I guess the answer you looking for is here: stackoverflow.com/questions/8497855/cache-background-image Commented Oct 18, 2016 at 13:19
  • @LuisP.A. so I need to cache my CSS as well? Commented Oct 18, 2016 at 13:21

1 Answer 1

3

Referring to a background image URL in CSS will form a HTTP GET Request within the browser which will first check the local cache for that URL.

So yes - if the file is cached locally, and the URL is exactly the same, it will pull it from the local cache.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, that is all I needed to know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.