Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

WebGL build won't start in Chrome

Discussion in 'WebGL' started by Sharples, May 26, 2016.

  1. Sharples

    Sharples

    Joined:
    Aug 5, 2015
    Posts:
    1
    (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
     

    Attached Files:

  2. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    583
    It load for me in chrome but yeah a small freeze is present.
     
  3. alexsuvorov

    alexsuvorov

    Unity Technologies

    Joined:
    Nov 15, 2015
    Posts:
    327
    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.
     
    Last edited: May 27, 2016
    Realman78 likes this.