-
• #2
this is a good point to start reading
-
• #3
Ok I already read that. But How can I enable CORS on Espruino or why's happening that?
-
• #4
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
-
• #5
extend the res.writeHead and play around with the Access-Control headers
res.writeHead(200, { 'Content-Type': 'text/plain', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept' });
https://developer.mozilla.org/de/docs/Web/HTTP/CORS#The_HTTP_response_headers
Let us know, if this works for you.
Look like I had missed to hit
Post reply
-
• #6
Great way! It's works! Thanks all by your support.
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?