Avoid PWA caching browser extensions.
such as: Chrome extension
This commit is contained in:
parent
d7f351b143
commit
c7241ba611
1 changed files with 3 additions and 1 deletions
4
sw.js
4
sw.js
|
@ -13,8 +13,10 @@ var cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M" }}';
|
||||||
|
|
||||||
|
|
||||||
function isExcluded(url) {
|
function isExcluded(url) {
|
||||||
|
const regex = /(^http(s)?|^\/)/; /* the regex for CORS url or relative url */
|
||||||
for (const rule of exclude) {
|
for (const rule of exclude) {
|
||||||
if (url.indexOf(rule) != -1) {
|
if (!regex.test(url) ||
|
||||||
|
url.indexOf(rule) != -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue