sw: never look in cache for query to a different domain

This commit is contained in:
Nicolas Wavrant 2020-04-10 06:50:23 +02:00
parent fc36423b57
commit 759a1a96b3
1 changed files with 5 additions and 1 deletions

View File

@ -53,13 +53,17 @@ self.addEventListener('fetch', function(event) {
pathname = url.pathname,
is_preview = url.searchParams.get("preview");
/* If different domain, then response is not cached */
if (window.location.hostname !== url.hostname) {
return event.respondWith(fetch(event.request));
}
if (event.request.referrer) {
var referrer_url = new URL(orig_request.referrer),
is_preview = is_preview || referrer_url.searchParams.get("preview");
}
if (pathname.endsWith("/edit")) {
console.log('Nicolas: ', pathname);
let offset_length = "/edit".length,
real_pathname = pathname.substring(0, pathname.length - offset_length);