I saw in some HP code that there is a question mark and a number after javascript file name and it seems like a date or something. What does “?” and a number behind after javascript is for? Example:
<script type="text/javascript" src="/folder/js/folderPageNextSubmit.js?20140801"></script>
it is for cache breaking, for example:
file.js?1234
file.js?12345
the browser treats them as two different files, so even if the first one was cached so the second one will be fetched anyway.
you change the number after you do a change in the file code and deploy it, so for the users to see your new changes and load the new file, you change the number.
The "?" in JavaScript or CSS files is a way to add versioning to the file.
Is useful to avoid browser caching when you are working in dev environments because when the versioning number changes, the file URL also changes. So seems to be a different file for the browser.
Is a common practice use a timestamp as versioning number to get something unique but you can use any numbers or chars.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With