Jump to content

Cross origin problem with Loader and spritesheet json file on android device


Recommended Posts


I am having problem loading texturepacker .json file on android device.

Pixi code:
var loader = Loader.add('images/sprites.json').once('complete', onAssetsLoaded).load();

Here is the error message:
chromium: [INFO:CONSOLE(0)] "XMLHttpRequest cannot load content://com.company.test.AVC.files/assets/images/sprites.json. Cross origin requests are only supported for protocol schemes: http, data, chrome, https.", source: content://com.company.test.AVC.files/assets/index.html (0)

My app is packed into apk using Corona SDK.
(I packed html projects before w/o problems)
This is my first Pixi project displayed inside Corona's WebView...
Are there known issues between Corona and Pixi?

Link to comment
Share on other sites

This isn't a pixi issue, the problem is right there. You are doing a crossx domain request (the protocol/domain is different) but x-domain requests are disabled for any protocol except http, data, chrome, and https.

Nothing we can do about this on the loader, you would need to reconfigure the browser which I don't know if Corona lets you do. You would have to talk to them.

Link to comment
Share on other sites

Thank you xerver

I am afraid that corona can't help. 
It uses android browser to displaying web content...
I don't think that chrome allows that on devices.

Maybe pixie can help?
Is it possible to pass object which contains sprite data to Loader instead of path to json file?
(sprite data is from Texturepacker)

Something like:
Loader.add({my object})

In that case I don't have to worry about that CORS thing...

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.

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.


  • Recently Browsing   0 members

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