Cache iframe request with ServiceWorker

Viewed 3925

I'm trying to cache the request of an iframe with my ServiceWorker (using sw-toolbox.js).

But no matter what I try the files are never served from the ServiceWorker as Chrome Network Tab tells me.

Here is my service-worker.js:

'use strict';
importScripts('./build/sw-toolbox.js');

self.toolbox.options.cache = {
    name: 'ionic-cache'
};

var static_urls = [
    'https://quiqqer.local/test?app=1',
    'https://quiqqer.local/calendar?app=1'
];

self.toolbox.precache(static_urls);

self.toolbox.router.any('/(.*)', self.toolbox.cacheFirst, {origin: 'https://quiqqer.local'});

self.addEventListener('install', function (event)
{
    self.skipWaiting();
});

self.toolbox.router.default = self.toolbox.cacheFirst;

The self.toolbox.precache() function makes the requests to my static_urls properly, as I can see in the Network Tab.

But all the requests coming from the iframe (going to https://quiqqer.local/) seem to not being routed through the ServiceWorker.

What am I doing wrong? Or isn't it possible to cache the iframe requests?

Running on Chromium using Linux.

Thanks in advance

1 Answers
Related