Created
April 11, 2016 08:58
-
-
Save igara/985839fa112a977ad23361a5fdafb1d3 to your computer and use it in GitHub Desktop.
閲覧しているサイトのServiceWorkerの登録削除とCache APIのキャッシュを全て削除するJSコード ref: http://qiita.com/igara/items/9564008194c74e12551e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.serviceWorker.getRegistrations().then(function(registrations) { | |
// 登録されているworkerを全て削除する | |
for(let registration of registrations) { | |
registration.unregister(); | |
} | |
}); | |
caches.keys().then(function(keys) { | |
var promises = []; | |
// キャッシュストレージを全て削除する | |
keys.forEach(function(cacheName) { | |
if (cacheName) { | |
promises.push(caches.delete(cacheName)); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment