Skip to content Skip to sidebar Skip to footer

Google Map Getting "initMap Is Not A Function" In Chrome Browser Only

Google map getting 'initMap is not a function' in chrome browser only. In other browsers (Firefox, IE, etc ) are working fine. I am using the Google MAP API for location search and

Solution 1:

The script should be on the below section. It can't find the "map" div hence creates a problem that leads to "initMap is not a function" problem.

<html>
<head></head>
<body>
<div>
  <div id="map" style="width: 500px; height: 400px;"></div>
</div>

<script>
    // scripts goes here
</script>
<script async defer
            src="https://maps.googleapis.com/maps/api/js?key={{KEY}}&callback=initMap">
    </script>
</body>
</html>

Solution 2:

use this

<script
src="http://maps.googleapis.com/maps/api/js?v=3&amp;sensor=false"></script>
$(document).ready(function() {
    ...
    google.maps.event.addDomListener(window, 'load', initMap);
});

Post a Comment for "Google Map Getting "initMap Is Not A Function" In Chrome Browser Only"