How to use a Service Worker With BASIC Authentication (NTLM, Negotiate)
<p>I have been trying to use a service worker within a IIS hosted web site that caches some of the static content of the site.  The site is an internal application that uses Windows Authentication.  I have been able to register and run a service worker without too much hassle, but as soon as I open the caches and start adding files to the cache, the promise fails with an authorisation failure.  the returned HTTP result is 401 Unauthorised. This is the usual response for the first few requests until the browser and the server are able to negotiate the authorisation.</p>

<p>I will post some code soon that should help with the explanation.</p>

<p><strong>EDIT</strong></p>

<pre><code>var staticCacheName = 'app-static-v1';
console.log("I AM ALIVE");
this.addEventListener('install', function (event) {
    console.log("AND I INSTALLED!!!!");
    var urlsToCache = [
        //...many js files to cache
        '/scripts/numeral.min.js?version=2.2.0',
        '/scripts/require.js',
        '/scripts/text.js?version=2.2.0',
        '/scripts/toastr.min.js?version=2.2.0',
    ];


    event.waitUntil(
        caches.open(staticCacheName).then(function (cache) {
            cache.addAll(urlsToCache);
        }).catch(function (error) {
            console.log(error);
        })
    );
});
</code></pre>