Open Siderite opened 4 years ago
The docs say that the Web cache API can only put http/https requests (https://developer.mozilla.org/en-US/docs/Web/API/Cache/put#Return_value). So this can be solved by adding a check in code like:
caches.open(version)
.then(function (cache) {
// here be the fix
if (!/^https?:$/i.test(new URL(request.url).protocol)) return;
cache.put(request, copy);
});
used in CacheFingerprinted.js and CacheFirstSafe.js
The docs say that the Web cache API can only put http/https requests (https://developer.mozilla.org/en-US/docs/Web/API/Cache/put#Return_value). So this can be solved by adding a check in code like:
caches.open(version) .then(function (cache) { // here be the fix if (!/^https?:$/i.test(new URL(request.url).protocol)) return; cache.put(request, copy); });
used in CacheFingerprinted.js and CacheFirstSafe.js
How do we add this to our code?
I think I found a fix to it
caches.open(version) .then(function (cache) { // here be the fix if(request.url.match("^(http|https)://")){ cache.put(request, copy); }else{ return; }
yes, it's works. Thanks
I think I found a fix to it
caches.open(version) .then(function (cache) { // here be the fix if(request.url.match("^(http|https)://")){ cache.put(request, copy); }else{ return; }
How did you apply this fix? Is this something that can be merged into the nuget package so we can all benefit from the fix?
I think I found a fix to it
caches.open(version) .then(function (cache) { // here be the fix if(request.url.match("^(http|https)://")){ cache.put(request, copy); }else{ return; }
How did you apply this fix? Is this something that can be merged into the nuget package so we can all benefit from the fix?
I added that in my service worker.js file
I don't know if it could be added to the nugget package
I can try to figure out a way to make a pull request to the repo to fix this
I went ahead and pulled down the source and just fixed it in the CacheFirstSafe.js, CacheFirst.js, and NetworkFirst.js. It seems to work well. Thank you!
I went ahead and pulled down the source and just fixed it in the CacheFirstSafe.js, CacheFirst.js, and NetworkFirst.js. It seems to work well. Thank you!
Check out this pull request if it would help
I got the same error, is this going to be merged in the next release?
I think @madskristensen is working on the next release
I got the same error, is this going to be merged in the next release?
Also I think you can just update your service worker directly before the release
How do I update the service worker??
you can create the service worker file but I think it is auto-created when you install the package
I get this error in the console from cache.put(request, copy). I don't see any way to fix it without downloading the source code and changing it.