title: Is it possible to register a service worker in a friendly iframe?
body: <p>Is it possible to register a service worker from inside a friendly iframe?</p>
  
  <p>What is a friendly iframe:</p>
  
  <p>A friendly iframe is an iframe that shares the same domain as the main page it is hosted on. This generally means that the content is trusted and hence, can ‘break out’ of the iframe and manipulate the content on the hosting page.</p>
  
  <p>Generally speaking serviceWorker has a register method which takes in a <code>string</code>. </p>
  
  <p>so it make sense i can pass a full absolute path <code>http://myowndomain.com/myserviceworker.js</code></p>
  
  <p>for clarification myowndomain.com is different from the hosting frame domain.</p>
  
  <pre><code>serviceWorker
   .register('http://myowndomain.com/myserviceworker.js')
    .then(serviceWorker =&gt; {
     console.log(serviceWorker);
    }
  })
  </code></pre>
  
  <p>and scope it globally. (control the current page by not passing scope to options object for the serviceWorker).</p>
  
  <p>will it work? </p>
  
  <p>if so, isn't it a security venerability? </p>