Any help with this HTML5 error? [SOLVED]

When bundling HTML5, I successfully create the index.html file. But i get this error when I open it, and the game never loads (stuck on the defold logo):

Access to XMLHttpRequest at ‘file:///Users/MYNAME/Desktop/VIHTML5/js-web/visualinstrument/visualinstrument.wasm’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.

Any help? Thanks

Are you just opening it in the build folder? It’ll be blocked for security reasons. You can launch a server locally (I don’t know how to do that) or upload it to somewhere like itch.io.

Thanks for your reply Alex, and yours Britzl.

My situation is a little strange. Let me explain: I created a tool for displaying animations which can be synchronised with music as part of a DJ set, for example. I’m now creating a controller with a raspberry Pi attached to a Player X PCB, which is a PCB you can use to create your own USB gamepad.

What I need is to create an executable which opens (and goes into full screen automatically) when the pi is turned on, even when there is no internet access available. Let’s break that into steps:

  1. Create a working HTML5 app and/or server
  2. Make it open automatically (I know this one is fairly easy)
  3. Make it fullscreen automatically (I don’t think this will be too complicated.

The first thing is to make 100% sure that a HTML5 app which doesn’t open on my mac also doesn’t open on my Pi.

Here’s my progress so far (just in case anyone is reading this and needs a much more in detail explanation for people who are not used to terminal ).

  1. bundle a HTML5 version, which creates a folder with various files inside, including one called index.html.
  2. Open terminal on Mac. Type cd and then drag the folder which contains the index.html file into the terminal window (this is a quick way of getting the address of that folder, which we need). Press enter.
  3. type python -m SimpleHTTPServer press enter.
  4. It should say Serving HTTP on 0.0.0.0 port 8000 …
  5. Open your browser and go to http://127.0.0.1:8000
  6. It should now be up and running!
3 Likes

Updating this even if it’s just for myself: the command line if you’re on python 3 is now
python3 -m http.server 8000