Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running locally in Chrome #3

Open
alarmatwork opened this issue Aug 18, 2021 · 4 comments
Open

Running locally in Chrome #3

alarmatwork opened this issue Aug 18, 2021 · 4 comments

Comments

@alarmatwork
Copy link

Massive Kudos for all the work. I will try to play around with machine learning a bit and use Wiimote as an input.

When you try to run index.html locally directly in browser, then it will raise an error

Access to script at 'file:///Users/xyz/code/wiimote-webhid/index.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, brave, chrome-untrusted, https.
index.js:1 Failed to load resource: net::ERR_FAILED

Is there any workaround for this or I should rather run it through the webserver?

@PicchiKevin
Copy link
Owner

Hi Alar! Thank you for checking it out.

The index.html page uses type="module" to load the javascript file so you'll have to use a web server or a static http server.

Machine learning? Are you doing some kind of gesture recognition?

@alarmatwork
Copy link
Author

alarmatwork commented Aug 18, 2021

Thanks will check how to get it working from the local file, seems like a Access-Control-Allow-Origin issue!

Yes, planning to learn TensorFlow a bit and will try to make machine learning to recognise letters written into the air with a Wiimote - just for fun and sake of learning since I have a wiimote laying in the drawer anyway. There is still a long way to go, but I will open source the code once I will get there.

@alarmatwork
Copy link
Author

You can close the issue. Found the workaround. Instead of accessing files through file:// I am running local server just:
python -m SimpleHTTPServer in the root directory of the project and then accessing files via: http://localhost:8000

@Ryuno-Ki
Copy link

For local dev purposes, adding http-server as dev dependency and invoking it as npm start, i.e. as start script in the package.json, could improve the developer experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants