Google map not loading

57 views
Skip to first unread message

Malinda Weerasinghe

unread,
May 29, 2016, 7:58:15 PM5/29/16
to Google Maps JavaScript API v3
Hi, I've added a google map for my website. But its not loading. So i refreshed page, still not working. Hope any help :-)

this is my code,

<script>
    var map;
    function initialize() {
      var mapOptions = {
        zoom: 8,
        center: new google.maps.LatLng(-34.397, 150.644),
        mapTypeId: google.maps.MapTypeId.ROADMAP
      };
      map = new google.maps.Map(document.getElementById('map-canvas'),
          mapOptions);
    }

    google.maps.event.addDomListener(window, 'load', initialize);

    </script>

Sudip Barman

unread,
May 31, 2016, 1:11:13 AM5/31/16
to Google Maps JavaScript API v3
Hi,
Did you include a div in the HTML with name "map-canvas" ?
If it is not the solution then can post your full code (HTML + JavaScript)

Thanks,
Barman

soum

unread,
May 31, 2016, 7:19:38 PM5/31/16
to google-map...@googlegroups.com
There is nothing wrong with the javascript code. 
Make sure 

1: You gave a div with an id = map-canvas 
2: The div has a height and a width. You will need that
3: If you are seeing any console error. 

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-js-a...@googlegroups.com.
To post to this group, send email to google-map...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.



--
soum

Reply all
Reply to author
Forward
0 new messages