To resolve this you do a hard refresh(ctrl+f5) but this only resolves the issue on your machine. if you have a large organization suppose 500 or more users, you don’t ask everyone to force refresh the page to see the changes.
This is how the browser caches the file and resolves this for everyone so that no one needs to hard refresh the page.
Likewise, if you have any CSS file use the same method –
<link rel="stylesheet" href="/projectcss/styles.css?v=01012021" />
Here in the link “href” property I have used an external CSS path and update the version with the date you can use any number of your choice and update the same each time you modify the CSS file.
If you refer to the file dynamically in server-side code use the same method and update the version in code like below –
@Html.IncludeVersionedJs("/scripts/jscustom.js?v=" + DateTime.Now.Ticks.toString());