Multiple browsers (Chrome, Firefox, Internet Explorer) give the following error when trying to open a local Unity WebGL build:
It seems your browser does not support running Unity WebGL content from file:// urls. Please upload it to an http server, or try a different browser.
Microsoft Edge is able to run it, but I would like to know if there are any settings that can be changed to get it to run on Chrome/Firefox/other browsers.
WebGL: The URL of the document as shown in a browser's address bar. Android: If the application has been launched or activated using an Intent Filter, a deep link (App Link) URL.
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 ;)
The correct way to run your Unity-WebGL app locally is to use a simple server.
Even Unity itself runs as a small web server run you run a WebGL build from the editor.
Here's one, Here's another, here's a whole list others
Turning off your browser security is as poor advice as turning off your virus scanner or your firewall. Don't do it. Especially when the correct way is so trivial.
These instructions were found in Dr. Tim Chamillard's game development course:
Firefox (recommended browser for running WebGL)
Chrome
Microsoft Edge
No need to do anything, WebGL builds work fine.
Safari
As a general rule, restart your computer after making these changes since browsers require it and some don't.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With