【发布时间】:2017-07-19 08:30:58
【问题描述】:
我正在尝试从我的 localhost 机器发出 get 请求(我的应用程序将保留在 localhost 上)以获取有关某个地方的一些信息。
但是,由于 CORS (XMLHttpRequest cannot load https://maps.googleapis.com/maps/api/place/details/json?placeid=[placeid]&key=[key]. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.),Google Places API 和/或我的 Chrome 不允许我执行此请求。
是否有某种方式(没有 CORS Chrome 插件)可以从 Google Places API 获取访问权限?
我只是在带有 Vue2 和 Vue 资源的 Javascript 中使用简单的 GET 请求:
this.$http.get(`https://maps.googleapis.com/maps/api/place/details/json?placeid=${googleplacesPlace}&key=${googleplacesToken}`).then(response => {
})
【问题讨论】:
标签: javascript google-maps google-places-api vuejs2