Reputation: 5624
I have seen following CSS rule at two website
/* First example */
background: #F8F8F8 url('/images/noise.png?1333540701') top left;
/* Second example from a different site */
background: #F8F8F8 url('/images/noise.png?1326131369') top left;
What does *.png?randomNumbers
mean after png image path? What purpose they serve here?
First one is from bastsov and the other is from Matt Gemmell. Both use Octopress framework.
Edit It is not that both rules are being used at the same site. Each rule comes from a different site.
Moreover, it seems they use the same number everywhere, whenever noise.png
is mentioned. For example,
/* rule for navigation bar */
background: url('/images/noise.png?1333540701'),linear-gradient(#E0E0E0,#CCC,#B0B0B0)
/* rule for #main */
background: #F2F2F2 url('/images/noise.png?1333540701') top left;
I observed the same pattern but with different numbers at Matt Gemmell's site.
Upvotes: 2
Views: 1620
Reputation: 700322
The number is just a part of the URL that is sent to the server to fetch the image.
There are two common reasons for doing this:
In this case the second reasons seems more likely. When a query string is used to return different images, the resource name is usually more generic.
Upvotes: 3
Reputation: 298166
The random numbers are a GET
request being sent to the image path. Since the image is just a static resource, nothing should change when you pass it parameters aside from its URL.
Browsers cache images to speed up page loading, but if you change the URL of the image, the browser re-downloads the image. It seems like noise.png
needs to be re-loaded every time.
Upvotes: 3
Reputation: 50493
Most likely it's a way to version the images since they are probably caching images. That way if the image is updated, they can change the numbers to avoid getting the older, cached image.
Upvotes: 5