Is there a way to clear browser cache using Javascript? When publishing a new release to an application, I sometimes have to tell my users to clear their browser cache to see the new changes.
The application is built using Vue.
Is there a way to clear browser cache using Javascript? When publishing a new release to an application, I sometimes have to tell my users to clear their browser cache to see the new changes.
The application is built using Vue.
I developed a PWA in Vue which had a lot of caching to be able to work offline as well, so distributing a new release was kind of tricky, solution that I settled on was deploying a version.txt file along my release and then periodically fetching that file from my app and when versions from .env files and version.txt don't match then I call:
caches.keys().then((keyList) => Promise.all(keyList.map((key) => caches.delete(key))));
to delete all cache, additionally I display a dialog that says new version is available and force a refresh so new content is served.
I hope this answer gives you an idea what you need to do to be able to publish a new version properly.