Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Load images from another domains


Recommended Posts

Hello, my dear friends!

I have a trouble while using Phaser. Please help me.

Why here second image is loaded, but first isn't?

new Phaser.Game(300, 300, Phaser.AUTO, null, { preload: preload, create: create });function preload() {  this.game.load.crossOrigin = 'anonymous';  this.game.load.image('testSprite1', 'http://vk.com/images/camera_100.png');  this.game.load.image('testSprite2', 'http://cs618720.vk.me/v618720408/20bbb/PQWVapnJZMw.jpg');}function create() {    this.game.add.sprite(10, 10, 'testSprite1');    this.game.add.sprite(10, 120, 'testSprite2');}

Thank you very much.

Link to comment
Share on other sites

vk.com has a CORS Header in place that blocks your request.

Image from origin 'http://vk.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://s.codepen.io' is therefore not allowed access.

You can view it in the browser, but can't access it from another domain.


Make sure you read your console logs! This was an easy to spot error if you know how.

Here is a short primer on debugging JavaScript in the Browser: https://developer.chrome.com/devtools/docs/javascript-debugging


Good Luck!

Link to comment
Share on other sites


  • Recently Browsing   0 members

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