-2

I want to show map of my university but it load for 1 sec and then tell

MissingKeyMapError

and

Sorry! Something went wrong. This page didn't load Google Maps correctly. See the JavaScript console for technical details.

I use Google Maps JavaScript API and Web browser (javaScript).Hear is my code :

    <script src='https://maps.googleapis.com/maps/api/js?key=AIzaSyDNi7fQreXQ_AvjDEbMBGtBo2XoP5QkxRs'></script>
    <div style='overflow:hidden;height:440px;width:700px;'>
        <div id='gmap_canvas' style='height:440px;width:700px;'></div>
        <style>#gmap_canvas img {
            max-width: none !important;
            background: none !important
        }       </style>
    </div>
    <script type='text/javascript'>
        function init_map() {
            var myOptions = {
                zoom: 14,
                center: new google.maps.LatLng(22.3475365, 91.81233240000006),
                mapTypeId: google.maps.MapTypeId.ROADMAP
                };
            map = new google.maps.Map(document.getElementById('gmap_canvas'), myOptions);
            marker = new google.maps.Marker({
                map: map,
                position: new google.maps.LatLng(22.3475365, 91.81233240000006)
            });
            infowindow = new google.maps.InfoWindow({content: '<strong>University of Chittagong</strong><br>Chittagong , Bangladesh<br>'});
            google.maps.event.addListener(marker, 'click', function () {
                infowindow.open(map, marker);
            });
            infowindow.open(map, marker);
        }
            google.maps.event.addDomListener(window, 'load', init_map);
    </script>
</head>

This is my full code . Please help me for my project.

mostafiz67
  • 159
  • 1
  • 9

1 Answers1

0

Where did you get that key? Like Vishnu said, that should be the problem. If you did not get it from the Google Maps API documentation you should go there and get a new one (they are accessible for free). Also, the title of your question seems misleading in my opinion, as you do not seem to use PHP.

  • Now i use new API Key from google . But same problem – mostafiz67 Aug 20 '16 at 12:08
  • It can take a couple of minutes before it works. This error shouldn't be thrown for any other problem as far as I know, if you signed up for your API key correctly then either it should work or some other error will be thrown. – TeachMeToAim Aug 20 '16 at 12:19