Jump to content

Google AJAX Search API


ben3001

Recommended Posts

Ok so im using the Google AJAX Search API. I have the search map on both sites. Whether i upload to the .com or .co.uk they are both the same.I have both domains .com and .co.ukGoogle only allows me to register an api code for one website therefore when i visit the map for the .co.uk uk i get an error. Does any one know a way around this?Also for some reason the code i have does not work with firefox.

Link to comment
Share on other sites

You may want to just register another key for the other domain, and on the page you should be able to detect which domain they are on with the HTTP host header, and use the appropriate key. Google might also have some documentation on what to do if you have a server with several domains on it.

Link to comment
Share on other sites

I have had an idea but am not too sure on how to implement it.Is there away i can use some sort of javascript function?I mean like if this domain then use this key else use this key or something along the lines. This is the code i would use if it is on my .com

<!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">  <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&key=ABQIAAAApwvIdOL_9HCxcFWZW_Q-dhT2pls4ucFrFj7kTic48hr8iw4o8BSXLe5PxifsO5RcRdJcqtTD1X1MWQ"	  type="text/javascript"></script>	<script type="text/javascript">	//<![CDATA[	function load() {	  if (GBrowserIsCompatible()) {		var map = new GMap2(document.getElementById("map"));		map.setCenter(new GLatLng(37.4419, -122.1419), 13);	  }	}	//]]>	</script>  </head>  <body onload="load()" onunload="GUnload()">	<div id="map" style="width: 500px; height: 300px"></div>  </body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...