I am trying to load a png texture file from an Apache server to a web application running on tomcat 7.0. I have set the .htaccess file and also have texture.Image.crossOrigin = "Anonymous". My response from the server looks like as follows:
Accept-Ranges:bytes
Access-Control-Allow-Headers:*
Access-Control-Allow-Methods:GET, OPTIONS
Access-Control-Allow-Origin:*
Access-Control-Allow-Origin:*
Connection:keep-alive
Content-Length:455867
Content-Type:image/png
Date:Tue, 01 Apr 2014 12:27:21 GMT
Etag:"420030b-6f4bb-4f58138b7d280"
Last-Modified:Wed, 26 Mar 2014 12:00:58 GMT
Server:Apache/2.2.22 (Ubuntu)
My texture code is as follows:
earthTexture = gl.createTexture();
earthTexture.Image = new Image();
earthTexture.Image.crossOrigin = "Anonymous";
earthTexture.Image.onload = function() {
handleTextureLoaded( earthTexture);
};
earthTexture.Image.src = imageURL;
I have set .htaccess file with the following line in it at the public_html/images folder:
Header set Access-Control-Allow-Origin "*"
But I still get the following error:
Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at http://XXXXXXXXXXXXXXXXX/images/image_2014.3.26_14.2.1.png may not be loaded.
Hope someone can assist me on this.