touché! heheheh
I didn't know there was a special way to asynchronously call the API,
it's good to know.

On Mar 21, 3:24 am, Luke Mahé <lu...@google.com> wrote:
> If you append &callback=myCallback 
> tohttp://maps.google.com/maps/api/js?sensor=falsethen the script will be
> added how you mention and will call the callback when the script has been
> loaded. 
> Seehttp://code.google.com/apis/maps/documentation/javascript/basics.html...
>
> -- Luke
>
>
>
>
>
>
>
> On Mon, Mar 21, 2011 at 5:21 PM, Todd Moyer <tmo...@gmail.com> wrote:
> > 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
> > google-maps-js-api-v3@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-maps-js-api-v3+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/google-maps-js-api-v3?hl=en.

-- 
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 google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to