After a lot of experimentation, I found something that worked, so I'll
summarise it here for anyone who googles across this post.
First, you need to use the async loading method:
var script = mglob.thiswin.document.createElement("script");
script.setAttribute("src", "http://maps.google.com/maps?
file=api&v=2.x&key=" + mapkey + "&c&async=2&callback=addMap");
script.setAttribute("type", "text/javascript");
mglob.thiswin.document.documentElement.firstChild.appendChild
(script);
What this calls back into depends on whether you're in a Firefox
extension or an IE BHO.
What I did was to build up a string mapFn containing a function called
addMap. Then:
- For Firefox add that string in as another script element by setting
innerHTML. From there you can build up the map as normal.
- For IE, I couldn't get it to add in a string as a script. But you
can have a separate method of the same name in the top-level script:
function addMap()
{
LOG("addMap - execute it");
eval(mapFn);
window.setTimeout(addMap, 1);
}
That gave me something that worked for both.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---