我正在尝试在以下页面中使用Google Maps API:https: //developers.google.com/maps/documentation/javascript/geolocation
我要做的就是将代码复制到该页面上并将其粘贴到我网站上的测试页面上。 http://kwt-events-com.stackstaging.com/content/api/maps.php
我有一个API密钥。我用了它,页面在google map上加载的很好。
问题是它无法检测到显示此错误的位置:“错误:地理位置服务失败”
我尝试过的 是:允许在浏览器和计算机中进行位置检测。我在同一台机器“ macos”上尝试了不同的浏览器。我在另一台计算机“另一台PC和另一台Mac”上尝试过。我在电话“ ios”上尝试过。
同样的错误
我知道我无法发布所有代码,但是病了,所以你们可以帮助我
<!DOCTYPE html>
<html>
<head>
<title>Geolocation</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head> …Run Code Online (Sandbox Code Playgroud)