nraynaud / webgcode

Online G-Code simulator, controller code for STM32F4-Discovery and google chrome extension to send the code to it.
http://nraynaud.github.io/webgcode/webapp/visucamTest.html#/
Other
373 stars 162 forks source link

Offline version of g-code simulator #39

Closed kebjs closed 1 year ago

kebjs commented 1 year ago

There is a g-code simulator here: http://nraynaud.github.io/webgcode/

Is there a way to have the g-code simulator run from disk (offline)?

Simply downloading it and starting it does not work:

Any hints?

Downloaded (offline) image

Online image

nraynaud commented 1 year ago

yes, Workers are absolutely forbidden from loading files from the local disk: https://stackoverflow.com/questions/21408510/chrome-cant-load-web-worker

Basically, to avoid mischievous javascript, all files loaded from file:// are considered as having a different origin, and a lot of things are forbidden accros origins. You best bet is to use a small HTTP server locally. Very often browsers will allow you to use http:// for restricted APIs, if the IP address resolves to localhost.

kebjs commented 1 year ago

Thanks for your quick response; a very short test gave the same results (in a node.js environment). I'll let you know if I manage to pull this off.