Fixed service worker cache bust
This commit is contained in:
parent
2179f17f00
commit
4dbb6e9f26
@ -1,4 +1,4 @@
|
|||||||
var CACHE = 'v1';
|
var CACHE = 'v2';
|
||||||
|
|
||||||
self.addEventListener('fetch', function(event) {
|
self.addEventListener('fetch', function(event) {
|
||||||
event.respondWith(fetchAndCache(event));
|
event.respondWith(fetchAndCache(event));
|
||||||
@ -7,7 +7,7 @@ self.addEventListener('fetch', function(event) {
|
|||||||
function cacheBust(request) {
|
function cacheBust(request) {
|
||||||
var url = request.url;
|
var url = request.url;
|
||||||
if (url.indexOf(self.location.origin) >= 0) {
|
if (url.indexOf(self.location.origin) >= 0) {
|
||||||
if (url.indexOf('.') < 0) {
|
if (url[url.length - 1] !== '/' && (url.indexOf('.') < 0 || url.lastIndexOf('.') < self.location.origin.length)) {
|
||||||
url += `/`;
|
url += `/`;
|
||||||
}
|
}
|
||||||
return `${url}?${Math.random()}`;
|
return `${url}?${Math.random()}`;
|
||||||
|
Loading…
Reference in New Issue
Block a user