This is how the cache works. If you want to refresh the cache as you already said you need to change your manifest file.
You must modify the manifest file itself to inform the browser to refresh cached files.
But you can use JS to check if the cache is changed.
You can get the cache object like this: window.applicationCache
window.addEventListener('load', function(e) {
// Add an event listener to the cache
window.applicationCache
.addEventListener('updateready', function(e) {
// Check if ready to update (The update ready status is 4)
if (
window.applicationCache.status ==
window.applicationCache.UPDATEREADY) {
// Get new app chache
// window.location.reload();
window.applicationCache.swapCache()
}
}, false);
}, false);
Check the official docs here: https://html.spec.whatwg.org/#applicationcache
Please note this feature is deprecated an you shouldn't use it
From MDN:
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
What should I do?
You should be using the new Service Worker API, it is a direct replacement for the Application cache. Service workers have all the features off App Cache and even more.
For Service Worker API check these: