Problem Uploading WebGL Game to Server


When I export my WebGL game it works fine offline, but when I transfer it via FTP to my web server and play from there, I get the following error:

An error occured running the Unity content on this page. See your browser JavaScript console for more info. The error was:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data"

Any help would be greatly appreciated! :slight_smile:

I guess you don’t really need a solution any more but there was already a thread like this with a solution posted. The original answer can be found behind this link and a copy of the code from that thread is also posted below:

To make this code work, you need to create a web.config file with the following code in it.
Then place the file next to your index.html on your server.

This works for me with Unity 5.6.1f1.

             <!-- Unity 5.6 -->
             <mimeMap fileExtension=".json" mimeType="application/json" />
             <mimeMap fileExtension=".unityweb" mimeType="application/binary" />
             <!-- Unity 5.x -->
             <mimeMap fileExtension=".data" mimeType="application/binary" />
             <mimeMap fileExtension=".mem" mimeType="application/binary" />
             <!-- Unity 5.3 -->
             <mimeMap fileExtension=".datagz" mimeType="application/binary" />
             <mimeMap fileExtension=".jsgz" mimeType="application/binary" />
             <mimeMap fileExtension=".memgz" mimeType="application/binary" />