code>service-worker.js</code> with its <code>offline.html</code> page and optionally registers the service worker (whose code is borrowed from <a href="https://web.dev/offline-fallback-page/#registering-the-service-worker">web.dev</a>):</p>
<div class="sourceCode" id="cb918"><pre class="sourceCode js"><code class="sourceCode javascript"><span id="cb918-1"><a href="mobile-pwa.html#cb918-1" aria-hidden="true" tabindex="-1"></a><span class="bu">window</span><span class="op">.</span><span class="fu">addEventLis