Solve the Uncaught unknown compression method Unity WebGL error

This Sunday I had to finish a silly game called Traffic Light Simulator for the Ludum Dare competition.

One of the many problems I encountered happened when I tried to upload the first version of the game to my server. As you may know, Unity has abandoned the WebPlayer option in favor of the WebGL option, which is under development so there will be bugs! It was always super-easy to make the WebPlayer option work online, but with each Unity update you have to learn a new way to make the WebGL option work.

First of all, the offline version worked fine in Firefox, but when uploaded the project to the server I got the following error:
An error occured running the Unity content on this page. See your browser's JavaScript console for more info. The error was: Uncaught unknown compression method.

When you open the Developer Tools console, you will see the following:
  • Failed to load resource: the server responded with a status of 404 (Not Found): Invoking error handler due to Uncaught unknown compression method
  • Uncaught unknown compression method
  • Failed to load resource: net::ERR_CONNECTION_RESET: Could not download Release/Test.datagz
  • Failed to load resource: net::ERR_CONNECTION_RESET: Could not download Release/Test.jsgz
So what do you do when you encounter an error you have't seen before? You google it! And if you google these errors you will find a lot of people with the same problem. The solution seems to be to modify the .htaccess file. But in the latest version of Unity, there's no .htaccess file in the WebGL folder! The second link on Google was Unity's own documentation, which is not updated to the latest version which is 5.4, so there was no solution there either. Another solution was to contact the server provider.

After digging around on the web, I found the solution, and it was this super easy solution: What you need to do is to modify the index.html, which is the only file in the WebGL folder. So open it in Notepad or whatever program you are using. At the bottom of the file, you will see the following lines:
  • dataUrl: "Release/", 
  • codeUrl: "Release/Test.js", 
  • memUrl: "Release/Test.mem", 
To solve the problem you have, you just have to add gz to the end of those lines:
  • dataUrl: "Release/Test.datagz", 
  • codeUrl: "Release/Test.jsgz", 
  • memUrl: "Release/Test.memgz", 

If you upload the new version you should see that everything is working fine!


  1. Thank you so much for posting this!! Helped a lot! :-)

  2. Interesting solution. Worked great for me.

  3. Fantastic!! It worked!!! Such an easy solution ... but that takes a lot to find out!! Thanksssss so much :-)))

  4. Wow, I have no idea what's going on there but it worked. For my project (maybe a later version of Unity?) I also had the line

    asmUrl: "Release/cat_quest.asm.js",

    which needed changing to

    asmUrl: "Release/cat_quest.asm.jsgz",

    Thanks so much for posting this solution!

  5. Hi there, I had the same issue popping up on a range of games we are developing, crazy thing is we are developing road safety games so the traffic light game is awesome.

    Anyway, when investigating we initially thought this issue was to do with the server having gzip compression, which can be tested by adding your site/game url to

    But this didn't work, so looking some more I stumbled on your fix to the index.html adding gz to the end, this would indicate the server has gzip compression and by adding gz to the end of the lines configures the index to know compression is on the site.

    However, saying that, we still have the same issue after turning compression back on and attempting your fix. :(

    Thanks though.


  6. worked great but had to add the "gz" fix also to the "asmURL" line.
    Thanks a lot!

  7. i tried the same method by adding gz to my file but i am still getting the same error when i am hosting unity webgl on server. I am using unity5.5 version

  8. there are no such lines of code in index.html file however that kind of code can be found in test.json which will be under build folder. test.json file looks like below
    "TOTAL_MEMORY": 268435456,
    "dataUrl": "",
    "asmCodeUrl": "WebglTest.asm.code.unityweb",
    "asmMemoryUrl": "WebglTest.asm.memory.unityweb",
    "asmFrameworkUrl": "WebglTest.asm.framework.unityweb",
    "splashScreenStyle": "Dark",
    "backgroundColor": "#222C36"
    now what should i do?how to replace with the new suffix "gz"
    Help is appreciated.

  9. Thank you, this was very helpful!


Post a Comment