I have a GeoJSON file saved locally and it is also present on GeoServer. I can successfully load it as a vector layer in my OpenLayers map when pointing to its GeoServer URL.

Is it possible to load the locally saved file without the use of GeoServer?

This is the error I get when I try to load it locally:

Cross origin requests are only supported for protocol schemes:
http, data, chrome, chrome-extension, https*"
  • How are you trying to load it, when using it locally?
    – nmtoken
    Apr 6, 2017 at 7:23

1 Answer 1


A quick overview, you can find countless answers for your 'problem' on the web:

Browsers (or more specific: clientside Javascript) in general are not permittet access to the local file system programmatically (without specific user interaction) (Same-Origin-Policy).

Your options here include

  • using HTML5 File API to let the user select a local file

  • a local http server instance (mainly for developement purposes), for example via Python 3.x

  • serving it via the public file system on your webserver (e.g. not locally)

There are tons of workarounds, but they are to be used with caution; the Same-Origin-Policy is a security implementation and its implications have good reasons to be followed!

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.