iframe-sw-shared-name.html (379B)
1 <!DOCTYPE html> 2 <title>Iframe for cross-origin Shared Worker</title> 3 <script src="/common/get-host-info.sub.js"></script> 4 5 <body> 6 <script> 7 8 const worker_url = new URL( 9 'shared-name.js', 10 get_host_info().ORIGIN + self.location.pathname); 11 12 let worker = new SharedWorker(worker_url); 13 worker.port.onmessage = e => { 14 parent.postMessage(e.data, '*'); 15 } 16 17 </script> 18 </body> 19 </html>