Google Maps v3 api for localhost not working

后端 未结 3 2113
庸人自扰
庸人自扰 2020-12-05 01:47

I wanted to try out a sample demo of implementing Gmaps v3 and tried out this example from Google\'s documentation, but there is no output , the page just loads for a few se

3条回答
  •  萌比男神i
    2020-12-05 02:24

    First of all: Google Maps 3 does not need an api key anymore, so you are fine with

    https://maps.googleapis.com/maps/api/js?sensor=false
    

    as an URL.

    (As Jeff Hoye pointed out, as of June 22, 2016, an API Key is required again.)

    And then you forgot the "new" in this line:

    var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);

    With those changes your map will be displayed.

提交回复
热议问题