Google Maps v3 api for localhost not working

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

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.

Leave a Comment