You need to sign in to do that
Don't have an account?
Michael Haddad.ax365
Google Maps API Key Error in Visualforce?
Hi all
I've created a Visualforce page that utilizes the Google Maps API to both create and display and map and do some geocoding. The page works, but I get the pop-up error at the beginning that says:
"The Google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at http://code.google.com/apis/maps/."
I'm making the request from https://na2.salesforce.com and am using the key ABQIAAAA9wWHEGNCfZW2F9-qCEHgohQ72da4xWLg1N8Ce02Xdu0VxpZsuRQSY7XJzvVLWb1SH9-ZtUeYmXh5_Q. This is the key Google gives me for https://na2.salesforce.com. I've also tried it with the key for http://na2.salesforce.com.
This is what my script tag looks like:
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA9wWHEGNCfZW2F9-qCEHgohQ72da4xWLg1N8Ce02Xdu0VxpZsuRQSY7XJzvVLWb1SH9-ZtUeYmXh5_Q" type="text/javascript"></script>
Again, the page works. I just get the error when it loads.
Any ideas?
Thanks!!
Michael
I've created a Visualforce page that utilizes the Google Maps API to both create and display and map and do some geocoding. The page works, but I get the pop-up error at the beginning that says:
"The Google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at http://code.google.com/apis/maps/."
I'm making the request from https://na2.salesforce.com and am using the key ABQIAAAA9wWHEGNCfZW2F9-qCEHgohQ72da4xWLg1N8Ce02Xdu0VxpZsuRQSY7XJzvVLWb1SH9-ZtUeYmXh5_Q. This is the key Google gives me for https://na2.salesforce.com. I've also tried it with the key for http://na2.salesforce.com.
This is what my script tag looks like:
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA9wWHEGNCfZW2F9-qCEHgohQ72da4xWLg1N8Ce02Xdu0VxpZsuRQSY7XJzvVLWb1SH9-ZtUeYmXh5_Q" type="text/javascript"></script>
Again, the page works. I just get the error when it loads.
Any ideas?
Thanks!!
Michael
in the past, when i see that message the maps do not work at all.
Thanks for the help. I've taken out my JavaScript, but this shows the page that is giving the error.
Message Edited by Michael Haddad on 06-24-2008 01:39 PM
then generated a new key, and put that into the page , changed & to & and it appears to work
here is the line i changed
Message Edited by Ron Hess on 06-24-2008 02:37 PM
if your key is not working, you can try to gen a new key and try that one.
This could be the start of a custom component...
It's interesting. The map worked before taking out the amp; although I got the error and the polyline I was adding didn't work. Now I don't get the error and the polyline works. Strange behavior!
I have a somewhat unrelated question. What is the procedure for using the AJAX toolkit inside a Visualforce page?
I'm including the scripts as follows:
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/13.0/connection.js" type="text/javascript"></script>
I have it working, but it seems to require me to login in an init function, otherwise I get a Session ID or Session Header error.
sforce.connection.login(USERNAME,PASSWORD);
Do I need to issue this call to use the toolkit in Visualforce?
Thanks!
Michael
what are you doing with ajax toolkit that cannot be done better by Visualforce ActionSupport?
i really would like to know, because we want to support your use case with the built in features if possible and not require you to employ the ajax toolkit on a visualforce page.
Hey guys,
I for the life of me can not get the Google Map to load! :( I'm presented with the following message:
"The Google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at http://code.google.com/apis/maps/."
Do you know exactly what URL I need to use to generate the key from? I'm testing this in my developer SalesForce.com implementation within a Visual Force page. At this point I'd be happy with the map simply appearing :)
Any help would be greatly appreciated,
Mark
.... ok, got the map to display. Re-generated the API key based on the URL below did the trick.
https://c.na2.visual.force.com/apex/
Hi, I am able to generate the Google Map API Key. I'm not getting any error on API Key, but the Map itself is not loading.
Please help.
Suvra,
Could you post the source code so we could take a look to help resolve your issue?
sure..
I need to implement it in Visual Force, not S-control. I have the S-Control code working fine..but i converted it to VF code, enclosing it whinthin <apex:page> tag, which is not working.
Below is the S-Control :
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script src="http://maps.google.com/maps?hl=en&output=html;&file=api&v=2&key=ABQIAAAAAU2IOEFrV1LYavl7OvxJjBQwNgRt8BDbI5KFRawO0dUAA_H1zxTwu7jPL6-izlVOZ3V76V8efAsRpA
" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
var address = "{!Contact.MailingStreet},{!Contact.MailingPostalCode} {!Contact.MailingCity}, {!Contact.MailingState}, {!Contact.MailingCountry}";
var firstName ="{!Contact.FirstName}";
var lastName ="{!Contact.LastName}";
var name=firstName+' '+lastName;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.addControl(new GSmallMapControl());
geocoder = new GClientGeocoder();
geocoder.getLatLng(
address,
function(point) {
if (!point) {
document.getElementById("map_canvas").innerHTML = address + " not found";
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml('<b>Customer: </b>'+name+' <br/> <b>Address:</b> '+address+'<br/><img height="50" width="50" src="http://www.visitingdc.com/images/white-house-picture.jpg">'+'<br/> '+'<a href="http://www.econym.demon.co.uk">Testing Link</a>');
}
}
);
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width:100%;height:300px"></div>
</body>
</html>
And the visual Force code is also given below :
<apex: page standardController="Contact" >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<script src="http://maps.google.com/maps?hl=en&output=html;&file=api&v=2&key=ABQIAAAAAU2IOEFrV1LYavl7OvxJjBR40BZvbDQwFS2t3SbxsCD7Ete1hhR7lBeH84nW9buCBPsB_zWEksNYTg" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
var address = "{!Contact.MailingStreet},{!Contact.MailingPostalCode} {!Contact.MailingCity}, {!Contact.MailingState}, {!Contact.MailingCountry}";
var firstName ="{!Contact.FirstName}";
var lastName ="{!Contact.LastName}";
var name=firstName+' '+lastName;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.addControl(new GSmallMapControl());
geocoder = new GClientGeocoder();
geocoder.getLatLng(
address,
function(point) {
if (!point) {
document.getElementById("map_canvas").innerHTML = address + " not found";
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml('<b>Customer: </b>'+name+' <br/> <b>Address:</b> '+address+'<br/><img height="50" width="50" src="http://www.visitingdc.com/images/white-house-picture.jpg">'+'<br/> '+'<a href="http://www.econym.demon.co.uk">Testing Link</a>');
}
}
);
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width:100%;height:300px"></div>
</body>
</html>
</apex:page>
Fot this Visualforce page, I generated API Key for the URL :
https://suvra.na6.visual.force.com/apex/
https://suvra.na6.visual.force.com/apex
But both are not working. I mean, its not thowing any error in terms of API key, but the map is not loading.
Hi,
Please post your code so we can help you.
Hi all
We've got the same problem.
I've searched the forums and the Google forums and hacve tried all the permutations I can think of.
I'm developing in a personal sandbox at the moment using Firefox 3.0.8
Here's my error msg
The Google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at
http://code.google.com/apis/maps/.Now..... I've generated myself a Google Maps API key using
https://na6.salesforce.com/http://na6.salesforce.com/
https://na6.visual.force.com/apex/
http://salesforce.com/
and a few more as well.
I've tried removing the amp from the & but no joy there either.
The page I generated has the following URL
https://na6.salesforce.com/apex/Google_Page?sfdc.tabName=01r80000000FvzlSTILL GETTING THE SAME ERROR MSG
Please help!!!
My code is as follows
<apex:page >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
<title>Google Maps JavaScript API Example</title>
<script src="http://maps.google.com/maps?
file=api&v=2&sensor=false&key=ABQIAAAA8f0frnZd5eaEpk3VlfvtiRTP-
nQO30TV4MerbYT8p0gD9BDdlBTqYiHXzxUcke-VzgNc9prgM_TtJg"
type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
map.setUIToDefault();
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</body>
</html>
</apex:page>
Has anyone got any idea why this is happening?
Thx in advance