PIXI JS CORS on Local
See original GitHub issueHello guys! I have this problem below 🆘
Expected Behavior
I want my html file to load on Google Chrome by just double clicking it. The images are in file:///C:/wamp64/www/sitefolder/imgs/
I want PixiJS to load them on
var texture = PIXI.Sprite.from(Image Path which is 'file:///C:/wamp64/www/sitefolder/imgs/image1.jpg');
Current Behavior
When I open the site on file:///C:/wamp64/www/sitefolder/site.html
I have these errors:
Same error occurs when I try to load an image from external source like: https://image.freepik.com/free-photo/close-up-hand-holding-smartphone_23-2148989917.jpg even though I am on localhost
I tried
- using canvas but wont let me do toDataURL() because the canvas was tainted
Steps to Reproduce
Open your a site with PIXI JS on file:///C:/wamp64/www/site.html
Environment
pixi.js
version: I build mine here https://pixijs.io/customize/- Browser & Version: Version 91.0.4472.114 (Official Build) (64-bit)
- OS & Version: Windows 10 21H1 (OS Build 19043.1052)
- Running Example: N/A
Localhost
There is no issue when opening it on localhost/sitefolder/site.html
I just want my users to see the sample of the code / animation / effect by just double clicking it on their folder or opening it on Google Chrome.
Thank you in advance!
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
You need to upload your web game so people can play it on the web 😛
itch.io is a free place to upload your game or if you want to make a computer game you can try wrapping it inside something like electron or nw.js
Based on your path it looks like you’ve got WAMP installed, so you should be opening your HTML file through that, not via
file://
.Have a read of the WAMP docs to get up to speed on how to access localhost via it. Until you do that, this error will persist, as browsers are not allowed to do pretty much anything when running via
file://
(for good reason, too).