1

I created an HTML page (currently locally) and used Leaflet to create a basic map to which I plan to add several shapefiles. To do this, I use the leaflet.shapefile extension (https://github.com/calvinmetcalf/leaflet.shapefile) and everything is working pretty good so far.

That is, in Firefox. If I test the page in Internet Explorer or Google Chrome, everything except for the shapefile I use for testing shows up.

I uploaded the page to mediafire (http://www.mediafire.com/download/wdib96x6udbnq2h/web.rar), index.html is the main page.

I consider myself pretty seasoned in GIS and Cartography terms, but I'm fairly green when it comes to the web stuff like HTML, so if this not the right question for this forum feel free to point it out : ) .

0

Are you running this locally? In the Chrome console (F12) I get a cross origin error on your zipped shapefile when trying to open index.html from the file system.

XMLHttpRequest cannot load file:///C:/Users/web/kaystros_osm_Project.zip.    
Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

Chrome is more strict about cross origin policy than Firefox is for local files.

There are many posts on stackoverflow about this. This (relatively old) answer, suggests that in Linux you may be able to disable this by running chrome with

chrome --disable-web-security

A somewhat more recent answer suggests this:

chrome --allow-file-access-from-files

Alternatively, you can try running a web server locally, or uploading the project to an actual web server.

  • Thanks for your answer, it seems that the problem stems indeed from the fact that i currently operate the page locally and Chrome doesn't like accessing local files for some reason. I will upload the finished page to a web server (my college's), I will post the results here. – Marius_O Jul 21 '15 at 19:24
0

OK Guys and Girls,

I think toms pretty much nailed the problem. The site was running locally on my PC, i edited the html,css and javascript with an editor and opened the html dircetly in the browser.

Only Firefox displayed the zipped shapefile.

The problem seems to stem from the fact that only Firefox allows locally hosted files, which took me quite a while to realize since I don't use any other browser and am pretty much inexperienced with developing web stuff.

Now I installed XAMPP (https://www.apachefriends.org/de/index.html) to quickly set up a local server for testing and loaded the site onto it. Both IE and Chrome now display the file correctly, which seems to prove the theory suggested by toms.

Many thanks to you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.