SoFunction
Updated on 2025-04-10

Description of the reasons why the js or css file is followed by parameters

I often encounter js and css files loaded on the page with parameters, such as:

<script type="text/javascript" src="?version=1.2.6"></script><link rel='stylesheet' href='?version=2.3.3' type='text/css' />
There are two possibilities for using parameters.

The script does not exist, but is generated dynamically on the server side, so it has a version number to show the difference.
The client will cache these css or js files, so every time the js or css file is upgraded, the client browser will download the new js or css file again.
The second case is the most, and it may also be that the two may exist at the same time.

The version number can be a random number or an incremental value, in a large version of the small version, or written according to the script generation time. For example, 20080727182553 is the second to the generation of the script, and 2.3.3 is the way to the large version of the small version.