I copy, after setted api key( Should I generate a special key(browser,adnroid)?? ) , a html code of this page (Google Maps JavaScript API v3) in a new html page, and all works perfectlly.
This is a script of html page that works:
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCo1Q9VJ...xr7R4aOBDzY&sensor=false">
</script>
On Worklight Prject, with Dojo, the maps isn't show.
I import the script with dojo/request/script . This is .js code:
function dojoInit() {
require([ "dojo", "dojo/request/script","dojo/parser",
..
], function(dojo,script) {
dojo.ready(script,function() {
script.get({
url : "http://maps.googleapis.com/maps/api/js",
content : {
libraries : "places, geocode",
sensor : "false",
callback : "initialize",
key: "AIzaSyCo1Q9....cqXhAxr7R4aOBDzY"
}
});
...
});
});
}
The initialize() function:
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(-34.397, 150.644);
var mapOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}
build-dojo.xml
..
<include name="dojo/request/script.js" />
The view is empty and not display the map.
There are no errors on browser's console but the function initialize isn't call.Why?