Hi friends of Espruino,
I hope that all ours are OK.
Now I'm trying to connect to a Http server made in Espruino like http://forum.espruino.com/conversations/334253/#comment14748665 from JS Client, but happen a error of permission about Access-Control-Allow-Origin because my JS Client is in another server and my Espruino web server is in another IP. How can I enable CORS on Espruino or why's happening that?
this is a good point to start reading
Ok I already read that. But How can I enable CORS on Espruino or why's happening that?
use response.writeHead() and write out the CORS header that way.
I do it in this code - https://github.com/SpenceKonde/AzzyProjects/blob/master/Animate/Version9.js
extend the res.writeHead and play around with the Access-Control headers
'Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept'
Let us know, if this works for you.
Look like I had missed to hit Post reply
Great way! It's works! Thanks all by your support.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem