+ Start a Discussion
Pink TacoPink Taco 

Google map api key is only not working in Google Chrome.

Hi All, 

      Need your suppor ton this. The Google map API key is not working the chrome browser. Esle its showing result with on any other browser. Why So..???   The code and script written below.

 

 

<apex:page tabStyle="Account" standardController="Account">

 

<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAbfPnDaL24nk10UVODur46RQ4hZBRKujLa20gdgk6BGq02b_7dRSUc-gU9S7Sru9i0Z4lD1pGbwanwg" type="text/javascript"></script>
<script type="text/javascript">

 

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

var geocoder = new GClientGeocoder();

//var address = "{!Account.BillingStreet}" + ", " + "{!Account.BillingCity}" + ", " + "{!Account.BillingState}"+"{!Account.BillingPostalCode}" + "," + "{!Account.BillingCountry}";
var address = "{!Account.BillingStreet}" + ", " + "{!Account.BillingCity}" + ", " + "{!Account.BillingState}"+"{!Account.BillingPostalCode}" + ", " + "{!Account.BillingCity}" + "," + "{!Account.BillingCountry}";

var point = geocoder.getLatLng(
address,
function(p) {
if (!p) {
alert(address + " not found");
} else {
map.setCenter(p, 13);
var marker = new GMarker(p);
map.addOverlay(marker);
//marker.openInfoWindowHtml(address);
marker.openInfoWindowHtml("<font>{!Account.Name}<br>{!Account.BillingStreet} <br>{!Account.BillingCity} {!Account.BillingState} {!Account.BillingPostalCode} <br>{!Account.BillingCountry}</font>");
}
}
);


}
}

</script>

<div id="map" style="height: 300px"></div>

<script>
load();
</script>

</apex:page>

Omar E. JalapaOmar E. Jalapa

Hello:

 

Use single quotes for text or concatenate the variables, as in this example:

 

var address = var address = '{!Account.BillingStreet}, {!Account.BillingCity}, {!Account.Billingstate}, C.P. {!Account.BillingPostalCode}, {!Account.BillingCountry}';   

 

       

 

Test your code using JavaScript in an html page so you can check your code faster.

Greetings.