Jump to content

Asset loader not loading in chrome


tobbyd
 Share

Recommended Posts

Testing my Pixi program on my local machine and everything works fine in firefox but in chrome I get:

 

Image from origin 'file://' has been blocked from loading by Cross-Origin Resource Sharing policy: Received an invalid response. Origin 'null' is therefore not allowed access

 

 

code -------------------------------------------------------------------

function loadAssets(){

            console.log(":: Loading assets ::");
            
            var assetUrl = "assets";
            
            var loader = new PIXI.AssetLoader([
            
            assetUrl + "/shadow.png",
            assetUrl + "/byra_clean.png",
            assetUrl + "/dummy.png",
            assetUrl + "/wire.png",
            assetUrl + "/wire_flare.png",
            assetUrl + "/kogg.png"
  
            ]);

            loader.onComplete = onAssetsLoaded;
            loader.load();

 

 

How do I make it work in chrome? I already tested putting the image files on an external server and loading them by setting assetUrl="http://externalserver/assets"; but I get the same error.

 

I have to make it work for every user entering the site with chrome as browser.

 

Thanks!

Link to comment
Share on other sites

Its my first minute here but this is not a problem from pixi/phaser but chrome does not alow you to load data without beeing in the same domain/server. Install an http server localy and try it.
It should look like localhost/yourgame or somthing. Try https://www.apachefriends.org/de/index.html if you are using windows and on linux/mac you can simply start an python http server.  python -m SimpleHTTPServer 80. 

Regards

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...