javascript - Getting ApiNotActivatedMapError when trying to use embed map API despite the API being activated - Stack Overflow

I'm embedding a map in a webpage but I keep getting a ApiNotActivatedMapError for some reason, I&#

I'm embedding a map in a webpage but I keep getting a ApiNotActivatedMapError for some reason, I'm looking at it and it is activated. I'm just at a loss here.

<div id="map" style="width:100%;height:400px">My map will go here</div>

<script>
// Initialize and add the map
function initMap() {
    var mapProp= {
        center:new google.maps.LatLng(51.508742,-0.120850),
        zoom:5,
    };
    var map=new google.maps.Map(document.getElementById("map"),mapProp);
}
</script>
<script async defer
src=";callback=initMap">
</script>

Does anybody have any experience with this problem? Am I missing something simple? Thanks

I'm embedding a map in a webpage but I keep getting a ApiNotActivatedMapError for some reason, I'm looking at it and it is activated. I'm just at a loss here.

<div id="map" style="width:100%;height:400px">My map will go here</div>

<script>
// Initialize and add the map
function initMap() {
    var mapProp= {
        center:new google.maps.LatLng(51.508742,-0.120850),
        zoom:5,
    };
    var map=new google.maps.Map(document.getElementById("map"),mapProp);
}
</script>
<script async defer
src="https://maps.googleapis./maps/api/js?key=MY_API_KEY&callback=initMap">
</script>

Does anybody have any experience with this problem? Am I missing something simple? Thanks

Share edited Jul 12, 2018 at 13:52 xomena 32.2k6 gold badges96 silver badges125 bronze badges asked Jul 10, 2018 at 21:14 MattWolc24MattWolc24 1061 silver badge9 bronze badges 1
  • Which API did you activate in your project? The code that you posted requires a Google Maps JavaScript API be activated. – xomena Commented Jul 12, 2018 at 13:53
Add a ment  | 

1 Answer 1

Reset to default 9

Go to console.cloud.google. and follow the following steps:

1) APIs & Services

2) Dashboard

3) + Enable APIS and Services

4) Maps JavaScript API

5) hit Enable button

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742266843a4411955.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信