If I load the google maps api script tag in the HTML (by putting the
actual tag in the header in index.php) everything loads fine. If
instead I use the below code (with my actual key), it does not load!

 var script = document.createElement("script");

//This did not work
 script.src = "http://www.google.com/jsapi?
key=MY_API_KEY_HERE&callback=loadMaps";

//Nor this
script.src = "http://maps.google.com/maps?
file=api&v=2&sensor=false&key=MY_API_KEY_HERE"

 script.type = "text/javascript";
 document.getElementsByTagName("head")[0].appendChild(script);

(And yes, I put my api key in there correctly)

Instead it throws the error:

This web site needs a different Google Maps API key. A new key can be
generated at http://code.google.com/apis/maps/.


This error ONLY occurs if the script tag is loaded dynamically! What's
going on?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to