fsrojas Posted March 3, 2014 Share Posted March 3, 2014 Hi Guys, I recently using the last version of PIXI.js (1.5.1) and we are dealing with some problems with particular texture (that texture is in another host). Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at XXXXXX may not be loaded. To load the texture i'm using the asset loader and setting the crossorigin property by true. // assetsToInitloader has the url to the texture var preloader = new PIXI.AssetLoader(assetsToInitloader); preloader.onComplete = onAssetsInitloaded; preloader.crossorigin = true; preloader.load(); The same code is working fine on Safari, and having problems on Firefox and Chrome. Thanks in advance,Cheers! Quote Link to comment Share on other sites More sharing options...
fsrojas Posted March 4, 2014 Author Share Posted March 4, 2014 Any thoughts? The only way to set the crossorigin in PIXI is to set the crossorigin property (true), but this is not working. Can be a server problem maybe? Quote Link to comment Share on other sites More sharing options...
Mat Groves Posted March 4, 2014 Share Posted March 4, 2014 Hi there! Would you mind trying again with the latest dev build? Think we may have smooshed a cross origin bug. thanks! Quote Link to comment Share on other sites More sharing options...
fsrojas Posted March 5, 2014 Author Share Posted March 5, 2014 I tried the latest dev build and the error has changed to: Cross-origin image load denied by Cross-Origin Resource Sharing policy. Tested on Safari, Firefox and Chrome. Quote Link to comment Share on other sites More sharing options...
fsrojas Posted March 5, 2014 Author Share Posted March 5, 2014 I've recently use this solution http://www.corsproxy.com/ for retrieve the texture and works fine, maybe we have a server-side problem now (PIXI is OK!). Thanks for your answer! Quote Link to comment Share on other sites More sharing options...
agamemnus Posted November 22, 2014 Share Posted November 22, 2014 I've bumped into this problem using the 1.6.1 version of pixi. I'm using: base_image.crossOrigin = "Anonymous" ...doesn't help. Edit: I actually have a different error. "Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': Tainted canvases may not be loaded." Quote Link to comment Share on other sites More sharing options...
agamemnus Posted November 24, 2014 Share Posted November 24, 2014 Ok. I fixed my problem. I have no idea why, but switching my lines worked. WRONG:base_image.src = "url"base_image.crossOrigin = "Anonymous" RIGHT:base_image.crossOrigin = "Anonymous"base_image.src = "url" Quote Link to comment Share on other sites More sharing options...
wondernate Posted August 31, 2016 Share Posted August 31, 2016 This is not an error with Phaser. This is an issue of how your are running your website and browser security. You have to run your site from a webserver so the domain name of the page and domain name of the file are the same. You don't have all the info I need in the post so here is a common example.... I run my site by going to my filesystem and click on the index.html file. I then open in the browser with a patch like file:///C:/phaserwebsites/test01/index.html. So the domain is a file path. Then when your browser tries to go to the img file and load it into your html page it cannot because the domain changes to another file path which is essentially a different domain. This can also happen if you are running your site from Visual studio or another ide and it runs it on localhost:xxxx port. Here is the summary of how you solve it on windows. (sorry mac users Im a cheapskate so I like windows machines, but the principle is still the same if you can translate to MAC-anese) :-) 1. Insalled IIS 2. created a folder and put my website in it 3.Setup a site on IIS using that folder I just created as the stie folder and bound the url phasertest.com to the site in IIS site settings. 4.In my host file I pointed 127.0.0.1 to phasertest.com 5. Now in my browser I can just type in phasertest.com and the host file will redirect it to localhost which directs the request to IIS which has that site running from that folder. If that doesn't make sense then you will need learn about running web servers locally. Explaining that would be way to much for a simple post. Hope that helps! Quote Link to comment Share on other sites More sharing options...
krishnanjk7 Posted April 4, 2018 Share Posted April 4, 2018 If you simply running the html file means it's showing error. Try to run in local server wampp, xampp or ampp. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.