Open Bug 1412016 Opened 2 years ago Updated 2 years ago
cross domain issue
:: Developer Documentation Request Request Type: Correction Gecko Version: unspecified Technical Contact: :: Details There is an issue with the following lines in Chrome browser: game.load.image('ball', 'img/ball.png'); ball = game.add.sprite(50, 50, 'ball'); Code renders fine in Firefox and Safari, but throws the following error in Chrome: Uncaught DOMException: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at .../img/ball.png may not be loaded. I have encountered similar issues previously, when content is 'served' locally. Is there a simple fix, which does not require a server? I am running OSX macOS Sierra version 10.12 Firefox: v56.0 (64bit) Safari: Version 10.0 (12602.1.50.0.10) Chrome: Version 61.0.3163.100 (Official Build) (64-bit) Thank you!
Hi there, Yes, this is a problem because of Chrome's recent move to stricter security policies. To fix it, you'll have to use a local server and look at your demo files through that. We've written up an easy way to do this at https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server I probably ought to link to this from the article series.
Assignee: nobody → cmills
Hello, Yes, I found the Python solution via the Phaser.io, they cover the how and why [server] questions pretty thoroughly, and include a link to an article on linuxjournal [dated Sept. 2009!] which provides the Bash/Python [v2 Python] commands. I have Apache [factory OSX] installed, but I like the Python server solution better for this type of thing. Also, it is a big thumbs up from me, to the game dev fairies. I have looked at 3 of the 4 tutorials. They are carefully written, and close to exceptional. Ironic too, AFAIR they are [far] better than anything I have [so far] found on Phaser.io and/or elsewhere. The cross-origin issue is also encountered here: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Using_images Thanks. -u
You need to log in before you can comment on or make changes to this bug.