1
votes

I am new to openlayers and javascript. I was trying to add a vector layer on top of a tile layer as instructed in the example (http://openlayers.org/ol3-workshop/layers/vector.html). Code and the urls are perfect. Opening the file on the browser shows the map but without the vector layer. When I checked the javascript console on the browser, it shows this error:

XMLHttpRequest cannot load file:///C:/Users/tanwar/Desktop/MapProject/v3.6.0/7day-M2.5.json. Cross origin requests are only supported for protocol schemes: http, data, chrome-extension, https, chrome-extension-resource.

What does this error mean, I am not able to understand? How can I make it correct?

1
My suggestion is: setup your development scenario better, install a web server like apache2 or nginx, so you can use http protocol locally. - Jonatas Walker
Thanks. The problem was because of no web server. Now I have uploaded them on a web server, and it is working fine. - Tarique

1 Answers

1
votes

You have a cross-origin problem. The data cannot be read from a source different to your development domain. Are you testing this on your localhost? My recommendation is to test with local data first.