WebGL build won't start in Chrome

(Unity ver. 5.3.5f1)
(Web Server: IIS 8 on GoDaddy)

Hi,

I’ve created a release WebGL build of our product in order to test WebGL deployment and have run into several issues in Chrome. While I have had limited success addressing these issues I lack any previous experience and I’m concerned that my solutions may not be the right things to do.

The first issue (which I believe I have resolved) was the lack of CORS headers in the project which were preventing the loading of the resources. I have created a web.config (attached as .txt file) which sets the appropriate headers and also configures the import rules so that the site can decompress the .gz files properly.

The second issue I had was that the the vanilla release build from Unity referenced ‘Current Build.js’ in Index.HTML (attached as .txt file) which led to the browser trying to decompress a non-existent file. This seems to have been fixed by renaming ‘Current Build.js’ to ‘Current Build.jsgz’ along with the .mem and .data files.

After addressing the above issues I have the build running in FireFox (albeit with a script error on start) but I can’t seem to get it running in Chrome. The Chrome Console shows a few errors on start but the Unity forums seems to suggest that they’re known errors that shouldn’t affect the running of the build. As it stands it seems that Chrome loads the page fine but is having trouble rendering the canvas which freezes the tab.

You can access the test build at http://webtest.ddzgames.co.uk

Thanks

2650667–186772–index.html.txt (1.49 KB)
2650667–186773–web.config.txt (3.89 KB)

It load for me in chrome but yeah a small freeze is present.

Hello Sharples.

You don’t need to provide CORS for this project because you are not using cross-domain access here. Also you don’t need to change your server configuration, as the initial 404 error (that you can see in the console for release builds) is expected and it just informs the loader to fallback to JavaScript decompression. Try to disable all the changes to the server configuration and upload a fresh build without any modifications.

Your Chrome issue is unrelated to the server configuration, as it is also reproducible locally. If you want to test your build in Chrome without any server, then just launch Chrome with the –allow-file-access-from-files flag in the command line, i.e:
“c:\Program Files (x86)\Google\Chrome\Application\chrome.exe” --allow-file-access-from-files
Then a build from your local drive like file:///C:/path-to-your-build/index.html should work in Chrome correctly (try an empty project first to make sure you are using the flag properly).

After you make sure your build works in Chrome locally when launched from a local file path, you can upload it to a server and resolve server issues if present. This approach will also speed up your iteration times.

1 Like