I created a project in unity and exported it as WebGL, but when I open it in Chrome, I get this message (Please see image attached). If there is a fix, I need it to not have to be manually applied to the browser (if possible).
6 Answers
You need to run a local server
Here's a easy one
https://greggman.github.io/servez/
Here's a bunch more
What is a faster alternative to Python's http.server (or SimpleHTTPServer)?
They will take you 30 seconds to get going.
Basically if you load a webpage from a local file directly (file://some/path/to/file) chrome blocks that page from accessing other files because it's a security risk. If a local file could access other files on your computer it could upload those files to some other website so chrome blocks it.

- 100,619
- 31
- 269
- 393
-
running a local server made this error not appear but the game didn't work, and only showed nothing on screen – Gulzar Oct 09 '19 at 18:53
As the error states you cannot retrieve the resource you're looking for from an url that is prefixed with file://
(probably an image or a sound, your url probably looks something like file://SomeFolder/Foo/bar.jpg
)
Instead you need to host it somehwere the allows you to access the resource through http, and receive the resource over http.so you get an url like http://somehost.com/somefolder/bar.jpg
. you could do this using FTP or hosting yourself

- 4,843
- 5
- 30
- 60
-
-
Google Chrome does not allow you to load Unity webGL from the local file system due to security reasons. In order to play your webGL scene you need to upload it to a http server first, and then open that in your browser. So instead of loading it from a local location on your pc like "file://C/Users/Foo/Games/WebGL/MyGame" you need to load it from an actual web page like "`http://`mywebsite.com/games/myGame" if you have a hosted http server. Alternatively you can run your own local server. There are plenty of resources online that'll tell you how to run a local test server – Remy Nov 08 '18 at 10:37
- Just download Apache server from the following link download
- Copy paste the build file to C:\Program Files (x86)\Apache Group\Apache\htdocs
- Open your browser and type just localhost
or you can create a folder inside htdocs and calling it as localhost/foldername

- 12,190
- 6
- 97
- 81
here is a simple way.
Just open your terminal and go into your directory (where the HTML file lies), and start the server using one of the commands below.
python -m CGIHTTPServer 8360
python -m http.server --cgi 8360
python3 -m http.server --cgi 8360
This will open the port for you.
Then direct your browser to http://localhost:8360/YOURFILENAME.html The default one would usually be index.html ;)

- 463
- 4
- 9
You may have to have a folder called emperor_required_resources. Make sure the file (.html) and the unzipped folder is in the same location. I had similar problem and thank God a friend helped me out.