The code found here:
http://maps.google.com/maps/api/js?sensor=false

Uses document.write()!  ARGGGH!!!

This will overwrite the entire page if anyone tries to initialize the
API after the page has loaded.

PLEASE change this:

function getScript(src) {
    document.write('<' + 'script src="' + src + '"' + ' type="text/
javascript"><' + '/script>');
}


To this:

function getScript(src) {
    var scrpNde = document.createElement('script');
    scrpNde.setAttribute('type', 'text/javascript');
    scrpNde.setAttribute('src', src);
    var head = document.getElementsByTagName('head').item(0);
    head.appendChild(scrpNde);
}


Or something like that that does not use document.write.

This is killing my AJAX application.

The W3C will back me up on this. Here's what they have to say about
document.write:

"Try to avoid using document.write() in real life JavaScript code. The
entire HTML page will be overwritten if document.write() is used
inside a function, or after the page is loaded. However,
document.write() is an easy way to demonstrate JavaScript output in a
tutorial."

I'm surprised the smart folks at Google Maps would make this
mistake. :)

I can overwrite the document.write method, but that just feels like a
dirty solution.

-- 
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