API google maps e o erro de chave usada em outro website

1) O primeiro passo a seguir é entrar no link abaixo

http://code.google.com/intl/pt-BR/apis/maps/

2) Faça o login com sua conta do Google

3)Abaixo preencha o input com a url de seu website

5) Coloque o código que eles passam em seu website e caso apareça o seguinte erro:

“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/.”

A solução é simples, observe que no codigo JS que ele mostra na página junto com sua chave existe essa linha:

sensor=true_or_false

Nesta parte é necessário escolher true ou false, senão o erro aparece.

deixe assim:

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true
    &amp;key=ABQIAAAAOKTwVZstSE8y4bc8MDISSRSv0GxuiuWvrwUiwCe0EJGYll9rxxRB_haN8lNI4vTaIOqRmw-Ua6KC6w"
    type="text/javascript">
  </script>

Obvio, com sua chave.
exemplo:

<!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"/>
    <title>Google Maps JavaScript API Example: Simple Map</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"
            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>
Compartilhar:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • RSS
  • Twitter
  • Add to favorites
  • Diigo
  • email
  • LinkedIn
  • Live
  • Mixx
  • MySpace
  • PDF
  • Sphinn
  • StumbleUpon
  • Yahoo! Bookmarks

Tags: ,

Leave a Reply