1

Why do use like this filename.css?2 or filename.js?4 What are those numbers after question mark?

I did research online but I didn't find any answer.

Thanks!

user2864740
  • 60,010
  • 15
  • 145
  • 220
bigbull
  • 11
  • 2
  • It is revision numbers or cache busters as listed below. When people release a new version of their javascript, they increment this by one to force people to grab the latest version of their JS. – Kyle Muir Sep 08 '14 at 22:58
  • You say you did research online, yet when I copy/paste the first line of your question into Google, we get the answer: http://stackoverflow.com/questions/4044085/what-does-used-after-javascript-filename-means Odd. – cookie monster Sep 08 '14 at 23:08

2 Answers2

7

These are called cache busters.

Usually, when a browser downloads a file (CSS, JS, etc.) it caches it so that it doesn't have to download it later.

However, this is a problem when you decide to update your file, because the browser thinks it already has the latest version. To work around it, we use the cache busters. When you make a change to the file, you also change the number after the question marks, which tricks the browser into thinking this is a different file for which it doesn't have a cache it, and forces a re-download.

rmobis
  • 26,129
  • 8
  • 64
  • 65
0

Sometimes JS scripts are created on the fly using server side technologies other times it is simply a version number to help with browser caching issues

Devarsh Desai
  • 5,984
  • 3
  • 19
  • 21