title: How to create a Web Worker from a string
body: <p>How can I use create a Web worker from a string (which is supplied via a POST request)?</p>
  
  <p>One way I can think of, but I'm not sure how to implement it, is by creating a data-URI from the server response, and passing that to the Worker constructor, but I've heard that some browsers don't allow this, because of the same origin policy.</p>
  
  <p><a href="https://developer.mozilla.org/En/Using_web_workers">MDN states the uncertainty about the origin policy around data URI's</a>:</p>
  
  <blockquote>
    <p>Note: The URI passed as parameter of the Worker constructor must obey the same-origin  policy. There is currently disagreement among browsers vendors on whether data URIs are of the same-origin or not; Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0) and later do allow data URIs as a valid script for workers. Other browsers may disagree.</p>
  </blockquote>
  
  <p>Here's also a post <a href="http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-March/030878.html">discussing it on the whatwg</a>.</p>