Charles Galpin <cgalpin@...> writes: > > Dan, I think you understand correctly, but unless someone else chimes in, I'm pretty sure this is your only choice. The good news is that it's very easy to run your own web server (and for anyone you distribute your cd to). Check out > > http://portableapps.com/apps/development/xampp > hth > charles > > > On Feb 8, 2011, at 9:39 AM, Daniel Vrbík wrote: > Hi,problem is, that I haven't server. This all is diploma thesis and output will be only on CD, so I need to have all my files in one folder somewhere in my computer :(. > > Thanks > > Dan > > P.S. Or maybe I only don't understand your advice, I'm really beginner in > this field of life :) > > 2011/2/8 Charles Galpin <[email protected]>Vrbikdan, the error says "Cross origin requests are only supported for HTTP". > What this is saying is you need to fetch the bodyGIS.kml via http instead of direct from the file. So run a web server (apache) and serve both your html file and the bodyGIS.kml via http and it should work. The URL will change to something likehttp://localhost:8080/data/body/bodyGIS.kml > Assuming your document root was D:/skola/diplomka/zkouska/uplneOdZacatku and you were running apache on port 8080 > hthcharles > > > > On Feb 8, 2011, at 6:00 AM, vrbikdan wrote: > > Hi, > > I have a problem with adding KML file to OpenLayers. The code I'm using is > > written below: > > > > var body = new OpenLayers.Layer.GML("body", 'data/body/bodyGIS.kml', { > > format: OpenLayers.Format.KML, > > formatOptions: { > > 'extractStyles': true > > } > > }); > > map.addLayer(body); > > > > The KML file is in my computer and Javascript Console in Google Chrome is > > telling me this: > > > > "XMLHttpRequest cannot load > > file:///D:/skola/diplomka/zkouska/uplneOdZacatku/data/body/bodyGIS.kml. Cross > > origin requests are only supported for HTTP." > > > > Do you anybody know, how fix this problem? I couldn't find the solution :(. > > Thanks > > > > P.S. I'm beginner in JavaScript and OL and this discussion. > > > > > > > > > > > > > > _______________________________________________ > Users mailing list > Users@... > http://lists.osgeo.org/mailman/listinfo/openlayers-users >
Ok, I have placed my kml file to the server and now I have another problem. Now, Javascript Console in Google Chrome is telling me this: "Origin null is not allowed by Access-Control-Allow-Origin." But I thought, that in kml file each point or vertex in line, have own coordinates, so why it needs origin or how I can fix it? Thanks for help, Dan _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
