title: Three.js and loading a cross-domain image
body: <p>I know this has been asked before, and I've read ever question and answer I've been able to find, but nothing works.</p>
  
  <p>I'm running this on a local server (IIS). I'm trying to load an image from imgur and then use that as texture for an object using the code:</p>
  
  <pre><code>var savedImage = /[^?]*$/.exec(location.search)[0];
  if (savedImage != "") { savedImageLoad("http://i.imgur.com/" + savedImage + ".jpg"); };
  
      function savedImageLoad(image) {
          var mapOverlay = new THREE.ImageUtils.loadTexture(image);
          sphere.material = new THREE.MeshBasicMaterial({map: mapOverlay, needsUpdate: true});;
          sphere.geometry.buffersNeedUpdate = true;
          sphere.geometry.uvsNeedUpdate = true;
      }
  </code></pre>
  
  <p>But it's giving the error:</p>
  
  <pre><code>Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at http://i.imgur.com/uBD0g95.jpg may not be loaded.
  </code></pre>
  
  <p>I've tried placing <code>THREE.ImageUtils.crossOrigin = "anonymous";</code>, or some variation of, at the beginning of my code, at the end, and at other various points. I've added a web.config with</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
   &lt;system.webServer&gt;
    &lt;httpProtocol&gt;
      &lt;customHeaders&gt;
        &lt;add name="Access-Control-Allow-Origin" value="*" /&gt;
        &lt;add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" /&gt;
        &lt;add name="Access-Control-Allow-Headers" value="Content-Type" /&gt;
      &lt;/customHeaders&gt;
    &lt;/httpProtocol&gt;
   &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>but that didn't work. This also doesn't work on a site hosted on bitbucket.org, which to me says I'm missing something in my code.</p>
  
  <p>It seems to be failing at the <code>sphere.material = new THREE.MeshBasicMaterial({map: mapOverlay, needsUpdate: true});;</code> line, as if I comment that out then there's no error (but then the mesh isn't updated).</p>
  
  <p>I'm really at a loss of what else to try here and any help would be appreciated.</p>