376231 (2) [Avatar] Offline
#1
Hi,

I get the following error on all my Chapter 2 exercises.

XMLHttpRequest cannot load http://devices.webofthings.io/pi/sensors/temperature. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

Help would be much appreciated.

Thanks
Vlad Trifa (16) [Avatar] Offline
#2
Hello, thanks for your remark. Quick question: what browser type and version are you using? Do you have the same result when trying with other browsers (recent version firefox/safari/chrome)?

We will look into this, but in the meanwhile, the easiest thing you could do (and should work) is to simply open the files directly (double-click on them so they have a file://... URL) as opposed to host in on a server (apache, etc.).

We'd love to know how it works.
376231 (2) [Avatar] Offline
#3
Thanks Vlad. I had the same problem with all browsers. Using file:// did not work either.
domguinard (69) [Avatar] Offline
#4
Hi there,

We'd like to help but have troubles reproducing the errors. Which operating system do you use? Did you try opening the file in the browser directly (file:/// or C:... on Windows, drag and drop should also work) or do you publish it via a Web server?

Also: did you get the latest version of the code? We pushed several fixes lately.

We tested again all the examples on Windows and Mac OSx with Firefox (>41) and Chrome (>46) which are the suggested browsers. Safari (>9) should also work.
Internet Explorer is unfortunately not supported (because of several incompatibilities among which CORS which is an essential feature for the WoT). We added a note in the book to mention that.

Let us know how that works.