Drupal module add Google Maps API script
I am developing a system which heavily uti开发者_如何学Clizes Google Maps v3.
I am working on a module which uses jQuery to dynamically insert my map div - that works.
But including the remote Google API JS script dynamically is proving difficult. I am trying the following in my modules hook_init():
drupal_add_js( "http://maps.googleapis.com/maps/api/js?sensor=false" );
drupal_add_js( "<script type='text/javascript' src='http://maps.googleapis.com/maps/api/js?sensor=false'></script>");
In either case, my app doesn't load. Including the script definition into page.tpl.php manually works of course.
Due to this topic, you should use
drupal_set_html_head();
for D6. in D7 you can load external js by passing "external" scope, but this is not backported to for D6.
精彩评论