Reputation: 63
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).
Upvotes: 2
Views: 11494
Reputation: 1
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.
Upvotes: 0
Reputation: 483
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 ;)
Upvotes: 0
Reputation: 3
Just install node, install live-server and run it in folder, it's very easy. For live server install run in command line "npm i -g live-server". Then go to folder where you exported your game and in command line run "live-server". And here you go.
Upvotes: 0
Reputation: 15649
or you can create a folder inside htdocs and calling it as localhost/foldername
Upvotes: 0
Reputation:
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.
Upvotes: 2
Reputation: 5173
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
Upvotes: 1