【问题标题】:google maps api search by location with Places librarygoogle maps api 使用 Places 库按位置搜索
【发布时间】:2013-07-16 15:46:04
【问题描述】:

我想简单地重新创建 Google Maps API 教程这个页面的地图界面:https://developers.google.com/maps/documentation/javascript/examples/places-searchbox。所以,我想在我的网页上有一张地图,可以使用 Google Places and Maps API 自动完成按位置搜索。在上面的链接中,他们发布了用于创建地图界面的 HTML 代码;但是,当我将代码复制到 notepad++ 并从中创建一个 .html 文件时,地图不会出现。教程中的代码是否有bug(点击“Java+HTML”代码查看)?

【问题讨论】:

标签: google-maps-api-3 google-places-api


【解决方案1】:

使用 chrome 调试器,缺少的是正在请求的 css 文件

failed to load resource:  file://localhost/maps/documentation/javascript/examples/default.css

您需要将 html 中的 css 样式表的 url 更改为:

<link href="/maps/documentation/javascript/examples/default.css" rel="stylesheet">

到:

<link href="https://developers.google.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">

它会起作用的

【讨论】:

  • 谢谢!修复了这个错误
猜你喜欢
  • 1970-01-01
  • 2013-06-28
  • 1970-01-01
  • 1970-01-01
  • 2015-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多