Download: Check if new file is on server


when the user clicks a button, I would like to check whether there is a new javascript file on my server and if so, download it. Let’s say there is a new version of this file every week. I’ve implemented the download already, but I would like to know how to best implement the check for the file version. Do I do this via the filename (e.g. add the date to the file name) or via headers? Do I somehow use ‘if-modified-since’?

Any help appreciated.

Best regards