register-sw-after-fallback.html (699B)
1 <!DOCTYPE html> 2 <script src="sxg-util.js"></script> 3 <script> 4 window.addEventListener('message', async (event) => { 5 try { 6 const scope = './scope/' + location.href; 7 await registerServiceWorkerAndWaitUntilActivated( 8 './service-worker.js', scope) 9 const iframe = await withIframe(scope, 'inner_iframe'); 10 event.data.port.postMessage({ 11 location: document.location.href, 12 is_fallback: true, 13 err: undefined, 14 iframe_body: iframe.contentWindow.document.body.innerHTML}); 15 } catch (err) { 16 event.data.port.postMessage({ 17 location: document.location.href, 18 is_fallback: true, 19 err: err.toString() 20 }); 21 } 22 }, false); 23 </script>