So, I lifted the code from the basic intro on loading up google maps
and I'm getting the following javascript error (from chromium's
developer console):

Uncaught TypeError: Cannot read property 'firstChild' of null:
maps.gstatic.com/intl/en_us/mapfiles/208a/maps2.api/main.js:255


Now, while looking through the developer console, I saw something that
may be of interest:

google.loader.KeyVerified = false;

However, I've double checked, and my key (for localhost) is indeed
correct.  Furthermore, if I try to use the same key for a wizard-
generated static map, that may -does- work.  So, whatever the issue,
it seems to lie in the differences in how they load the API.

The offending one, which does not work, looks like this:
<script type="text/javascript" src="http://www.google.com/jsapi?
key=ABQIAAAA3nyJk0lXZ1crqSgYKRViChT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSf-
X98DdSEw091ZNJ7NLxTw7Y3Gw"></script>
                <script type="text/javascript">
                  google.load("maps", "2.x");
                  function initialize() {
                var map = new google.maps.Map2(document.getElementById("map"));
                map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);
                  }
                  google.setOnLoadCallback(initialize);
                </script>

The one which does work looks like this:

<script src="http://maps.google.com/maps?
file=api&v=2&key=ABQIAAAA3nyJk0lXZ1crqSgYKRViChT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSf-
X98DdSEw091ZNJ7NLxTw7Y3Gw

It appears there may be something wrong with the loader in the former
piece of code, but I tried replacing the first script which specifies
the source and key with the second that specifies the source, key, and
api version, and it lacks the 'setOnLoadCallback' function.  I tried
toggling the version numbers between 2 and 2.x on both of them.  I
also removed the 'google.load' after replacing the script, since it
also lacks the function and it's really superfluous at that point,
anyway.

Any advice?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to