Note to Phaser users - images in embedded games don't load
Currently, games made with Phaser engine don't work when embedded in the game page (specifically, images won't load). But - there is a workaround.
What to do
If you build a game using Phaser, go to the phaser.js file (the one huge file that contains the whole engine), look for the following around line 5070:
if (typeof URL === 'function')
and change it into
if (false)
If you use the minified version of the engine (phaser.min.js), change instead
"function"==typeof URL?t.src=URL.createObjectURL
into
false?t.src=URL.createObjectURL
(this one wasn't tested)
Why it works
The content security policy (CSP) for embedded games contains the directive default-src 'self' data:, which allows game engines to show images using data: URLs, but not the more modern blob: URLs. The default in Phaser is to use blob: URLs, the changes above force it to use the data: fallback.
This took us a few hours to figure during LD51, hope it will help others.
@pov, can you add "blob:" to the CSP? If not, can you add this tip to the game embedding guide? I believe that this is where people will look if they have this problem.