-1

hello I have a problem I wish to integrate ue google map in my site but I do not understand it appears when I update the page but then it disappears. In the console it says "no APIkey" but I did it several times. I followed the site: developers.google

but I do not understand where the error lies. I put the html part if a person understand the error please ! I also follow this topic google api in my website but nothing appears !

<div id="map"></div>
<script>
  function initMap() {
    var ff = {
      lat: 50.638181,
      lng: 3.058227
    };
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 17,
      center: ff
    });
    var marker = new google.maps.Marker({
      position: ff,
      map: map
    });
  }
</script>

<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDWdGA-ndsHMtR5-cdZrc5SHtfKKBG5Bfg&callback=initMap">
</script>
Turnip
  • 35,836
  • 15
  • 89
  • 111
heysabbinah
  • 45
  • 1
  • 10
  • 1
    Run the snippet in your question. It tells you that you haven't activated the Maps API. See here: https://stackoverflow.com/questions/35700182/apinotactivatedmaperror-for-simple-html-page-using-google-places-api – Turnip Oct 16 '17 at 18:15
  • Thank you but i follow the topic and nothing appears again – heysabbinah Oct 16 '17 at 18:29

2 Answers2

1

Console says:- https://developers.google.com/maps/documentation/javascript/error-messages#api-not-activated-map-error

so activate your google map API key under project.

Sachin Kumar
  • 3,001
  • 1
  • 22
  • 47
  • How to activate a key? I follow the documentation. I select my project I generate a Key ! I don't put any restriction. I copy the Key but it's not working. – heysabbinah Oct 16 '17 at 18:31
  • Steps 1. go to https://console.developers.google.com/ 2. select project. 3. click on enable APIs And Services button 4. search for 'Google Maps JavaScript API'. 5. click enable – Sachin Kumar Oct 16 '17 at 18:41
  • I have just check on Chrome mobile version and refresh many time but map doesn't disappeared. – Sachin Kumar Oct 21 '17 at 11:43
  • Yes it's working now Thanks a lot ;) I clear data and it's working perfectly – heysabbinah Oct 21 '17 at 11:56
0

Your API key is not activated. Make sure to generate a new one following the guide: https://developers.google.com/maps/documentation/javascript/get-api-key?hl=de

Orlandster
  • 4,706
  • 2
  • 30
  • 45