Why the names of some css, js files have random numbers in them?

8.8k views Asked by At

Some websites seem to have file names such as 'assets/app-02b4523sev8fsd56e.js'. I have noticed that these numbers do not change though, so I thought it has something to do with security but I am not sure. Is there any reason behind this?

1

There are 1 answers

1
AudioBubble On BEST ANSWER

This is normally to break caches stored by the browser so that the latest version of a file is loaded. Every time a file is changed this value will normally be changed also. This can be done manually by changing the filename and/or the paths in other files referencing this file, or this can be done programatically in some way. You may also see this done like the following and it may also contain a timestamp rather than a hash like the above:

assets/scripts.js?v=20150611190618

This is often referred to as a 'cache-buster' amongst other names.