Skip to content

Commit b7ea998

Browse files
committed
Avoid PWA caching browser extensions.
such as: Chrome extension
1 parent d85baa8 commit b7ea998

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sw.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ var cacheName = 'chirpy-{{ "now" | date: "%Y%m%d.%H%M" }}';
1313

1414

1515
function isExcluded(url) {
16+
const regex = /(^http(s)?|^\/)/; /* the regex for CORS url or relative url */
1617
for (const rule of exclude) {
17-
if (url.indexOf(rule) != -1) {
18+
if (!regex.test(url) ||
19+
url.indexOf(rule) != -1) {
1820
return true;
1921
}
2022
}

0 commit comments

Comments
 (0)