This error is because textures used by WebGL must either be served from the same domain (origin) as the main page or they must be served with the correct cross-origin headers.
For the server: if your assets are served from a different domain you must ensure they have the correct CORS headers.
For the game/client there are two options.
First: If you set the ASSET_PREFIX config in the index.html to a URL, then all assets will be loaded from this prefix. If the ASSET_PREFIX is an absolute URL (for example, starting with “https://”) then we enable cross-origin loading on the textures.
Second: You can manually enable cross origin texture loading with this code:
var handler = this.app.loader.getHandler("texture");
handler.crossOrigin = "anonymous";
You must run this code before any textures are requested.
Hello, dave. I have another question. As you can see, I just modified the index.html :
In order to using the CDN, I need to separate the index.html and other files. So I must change the URLs in index.html and config.json. And every time I publish the game, I need to modify them manually.
Is there any way to change the URLs ? According to you :