On Sun, Sep 24, 2017, at 13:29, Amit Singh wrote: > Through angular js i'm making a $http.get request to the maps > directions api and i'm getting this error >> XMLHttpRequest cannot load >> https://maps.googleapis.com/maps/api/directions/json?origin=12.9330966756336,77.6308643817902&destination=12.931329492531,77.6295876502991&mode=walking&sensor=false. >> Response to preflight request doesn't pass access control check: No >> 'Access-Control-Allow-Origin' header is present on the requested >> resource. Origin 'http://localhost:8080' is therefore not allowed >> access.> What to do ?
I think it's probably all explained here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS The "preflight" failure appears to mean that Google does not allow requests from localhost, which is understandable as your implementation has to be public and localhost is private. Thus a likely solution would be to host your implementation on a publicly- accessible server on a real domain. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-js-api-v3+unsubscr...@googlegroups.com. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. Visit this group at https://groups.google.com/group/google-maps-js-api-v3. For more options, visit https://groups.google.com/d/optout.