相关疑难解决方法(0)

Localhost的Googlemaps API密钥

如何获取googlemaps api密钥才能在localhost上运行?

我已经创建了一个API密钥,在参考文献中我添加了以下内容:

Accept requests from these HTTP referrers (websites) (Optional)

Use asterisks for wildcards. If you leave this blank, requests will be 
accepted from any referrer. Be sure to add referrers before using this key 
in production. 

localhost
Run Code Online (Sandbox Code Playgroud)

这不起作用,如果我排除api键它也不起作用?

google-maps api-key google-maps-api-3

59
推荐指数
5
解决办法
10万
查看次数

Google Maps v3 api for localhost无法正常工作

我想尝试一个实现Gmaps v3的示例演示,并从Google的文档中尝试了这个示例,但没有输出,页面只加载几秒钟然后空白,没有输出.

<!DOCTYPE html>
<html lang = "en">
<head>
    <style type="text/css">
        html{height: 100%}
        body{height: 100%; margin: 0; padding: 0}
        #map-canvas{height: 100%}
    </style>
    <title>GMaps Demo</title>
    <script src = "https://maps.googleapis.com/maps/api/js?
                   key=${API_KEY}&sensor=false">
    </script>
    <script>
        function initialize(){
            var mapOptions = {
                center: new google.maps.LatLng(-34.397, 150.644),
                zoom: 8,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = google.maps.Map(
                      document.getElementById("map-canvas"),
                      mapOptions);
        }

        google.maps.event.addDomListener(window, 'load', initialize);
        </script>
</head>
<body>
    <div id = "map-canvas">
    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

javascript google-maps google-maps-api-3

42
推荐指数
2
解决办法
7万
查看次数

如何在localhost上使用谷歌地图简单的api

我已经在我的网站上请求了一个用于嵌入谷歌地图的链接

https://developers.google.com/maps/documentation/embed/start
Run Code Online (Sandbox Code Playgroud)

并授权每个人都使用链接来使用它

Referers: Any referer allowed
https://code.google.com/apis/console/
Run Code Online (Sandbox Code Playgroud)

但我还是收到了

The Google Maps API server rejected your request. This API project is not authorized 
to use this API. Please ensure that this API is activated in the APIs Console: 
Learn more: https://code.google.com/apis/console
Run Code Online (Sandbox Code Playgroud)

是否有其他方法可以在本地使用嵌入式谷歌地图测试我的网站?

编辑:他们说:

Easy embedding

Google Maps Embed API maps are easy to add to your webpage—just set the URL 
you build as the value of an iframe's src attribute. Control the size of the 
map with the iframe's height …
Run Code Online (Sandbox Code Playgroud)

google-maps localhost

19
推荐指数
2
解决办法
5万
查看次数

Google Maps v3 API密钥不适用于本地测试

我有一个API密钥.它是"浏览器应用程序的关键(带有引用者).它工作正常,但当我尝试在我的本地开发服务器上使用它时,我没有被授权.我使用MAMP,我的本地URL如下所示:http://mysite.dev.

在"Referers"部分,我有:

mysite.com/*
mysite.dev/*
Run Code Online (Sandbox Code Playgroud)

制作一个(.com)工作正常,所以我很确定我的语法是正确的.但无论我尝试使用本地版本,我都会收到Google的授权错误信息,告诉我:

Google已禁止将Maps API用于此应用程序.提供的密钥不是有效的Google API密钥,也未授权此网站上的Google Maps Javascript API v3.如果您是此应用程序的所有者,则可以在此处了解如何获取有效密钥:https: //developers.google.com/maps/documentation/javascript/tutorial#api_key

肯定有办法让这个工作!它是什么?

javascript google-maps google-maps-api-3

11
推荐指数
1
解决办法
5万
查看次数