Skip to content

Instantly share code, notes, and snippets.

@netlooker
Created March 20, 2025 21:41
Show Gist options
  • Save netlooker/04ee8b68cb47c866708a5d2c2f503899 to your computer and use it in GitHub Desktop.
Save netlooker/04ee8b68cb47c866708a5d2c2f503899 to your computer and use it in GitHub Desktop.
Clear Cache of PWA
// Clear caches
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames.map(cacheName => {
console.log(`Deleting cache: ${cacheName}`);
return caches.delete(cacheName);
})
);
}).then(() => {
console.log('All caches cleared');
console.log('Reloading page in 2 seconds...');
setTimeout(() => window.location.reload(true), 2000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment