Home > Enterprise >  Are hashes in the names Javascript and CSS files used for integrity checking?
Are hashes in the names Javascript and CSS files used for integrity checking?

Time:01-24

Many websites use hashes in Javacript and CSS file's name. For example, this page, as of writing, uses a file referred to with URL .../stacks.min.js?v=b0f9a80d741d. Other sites just place a short hash in the file's name: main.abcd123.js

  • Is this used automated integrity checking? For example, when the browser loads stacks.min.js?v=b0f9a80d741d, does is verify that a hash or digest of this file matches b0f9a....
  • Does this pattern have a name?

CodePudding user response:

Nope its not for integrety checking. It for cache busting. Browsers cache static files. Everytime a new version of this script is uploaded the ?v=X part changes (by the bundler/packager/...) so the browser thinks its a new file and downloades it again, instead of reading from the local cache.

  •  Tags:  
  • Related