Sometimes i find images on the sites added through css. Even if image name is (let's say) footer_logo.gif. In css it will be added as footer_logo.gif?1297280570

What do I miss in here?


3 Answers 3


The chances are that it's a cachebuster - used to ensure that the url is unique (typically a random number or a time stamp) and that the image is therefore forced to be reloaded. It might be used where images are generated by the server on the fly, as an alternative to using a different actual image name every time (which has knock on implications), this mechanism just ensures that the image is always reloaded.

See this page describing more info about cachebusters

I would imagine this number is almost certainly a timestamp, as it's encoding a date this year in unix time - the number of seconds since Jan 1 1970. Converting your number into a date, you get Wed Feb 09 2011 19:42:50 GMT+0000 which would be the last time that image was generated.

Of course it's not necessarily anything to do with the image or css. The question mark simply denotes that what is about to follow are some parameters passed in the url to the web server, which can be used for whatever is relevant on the website:

See https://stackoverflow.com/questions/574493/what-is-the-symbol-in-url-used-for-in-php

  • True, but the question is really what it's for when used in images.
    – e100
    Commented Jul 15, 2011 at 12:09
  • fair point - I have modified my answer to make it related to images Commented Jul 15, 2011 at 12:30
  • 1
    1302118869 = Wed Apr 06 2011. Probably it was the last time that page was regenerated. It just ensures that you always see the image on the website, not the one cached on your machine. It may not have actually appeared to change since YOU last visited it, but who's to say it hasn't changed back and forth in the mean time? Commented Jul 15, 2011 at 15:19
  • 2
    @funguy Imagine you have an image header.gif for, say, a 10K race website. You need that image to change when the race is finished, i.e. put the word "finished" on it somewhere. However, browsers like storing images locally because they take so long to download from the internet. So there is a chance that after you update the image someone will visit the site and see the original header.gif and not know the race has finished. You could avoid this by changing the file name (header_finished.gif) or just using a timestamp (?1302118869), which all browsers treat as a separate file.
    – citelao
    Commented Jul 15, 2011 at 15:24
  • 1
    @funguy not a website race - a website about a 10,000 meter running event. As another example lets say your header image on an e-commerce shopping site has occasional promotional or status messages built into the image. Instead of cluttering your server with different image files and having to come up with a new unique file name that you know you haven't used before, EVERY time you update or revert the header image on the website - this mechanism would allow you to use the same image file name whilst ensuring that visitors will always see the latest version. Commented Jul 17, 2011 at 8:45

Probably that's a cache prevention or a version number or a tracking method or someting else.

For example:

If you just place footer_logo.gif, everytime the image loads it may be stored in the cache memory of your browser (so the next times it loads it will fetch that cached version, it's faster).

If you plan to refresh it, you can add a query (in your example it's 1297280570), this way you tell the browser to refresh it (as long as it hasn't been loaded before). After that it will be cached again (it depends on the browser and webpage settings).

If it's a version number, it will work in the same way as the previous example, the "difference" is that it tells the developer which version it is using; In this case it can also use a dynamic system to change the image, it's more complex to explain here and would probably be done in a different way.

If it were a tracking method, when the image was loaded, the server would gather that query and use it in its statistics, etc.

It can be something else...

BTW, this question could belong to stackoverflow.


Some other possible answers.

1) Imagine if you have a blog and upload a photo called photo.jpg.

Some days later a friend send you a photo called photo.jpg. When you download it to your images folder you probably will rename it photo1.jpg or a more specific name. photo_sent_by_john.jpg

If you upload that photo there is no way the blog know how to rename the photo.jpg to anithing.

So it is safer to generate a unique random name.

2) It is better to have a randon name if you have a gallery of photos that you want the people to see in context, this is reading the article.

Before cms and this random rename on upload, you could have the name of a picture of your favorite actress if you found the first gallery/photo01.jpg and started retriving images in sequence.

If the name is random you need the specific name to retrive that.

A folder also can have random names.

This 2 scenarios are used not only in css but in public sites like youtube. All thoose have random names on the generated link.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.