简体   繁体   中英

This page didn't load Google Maps correctly. See the JavaScript console for technical details.before that showed map in 2s

I am using this code from google map API's and entered the API key, but still get the above mentioned error

@{
    Layout = null;
}
<style>
   #map {
        height: 400px;
        width: 200px;
}
</style>
<div id="map"></div>
<script>
    function initMap() {
       var map = new google.maps.Map(document.getElementById('map'), {
       center: { lat: 10.523900, lng: 76.212250 },
       zoom: 8
        });
      }
</script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAi6Ztik8PTvZFBFieP0k7aVWGMdNGHJ9c&callback=initMap"></script>

Update: It looks like your code is fine. I think this is an issue with the way you configure your site setting in google developer console - have a look at SO post .

It entails making sure you enter your domain wildcard properly ( http://www.example.com/* ) and enabling the required APIs ( Maps JavaScript API ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM