epoch, not sure about overlays although I think there is an addOverlay event you could try catching. The problem then would be working out which element to loop through to find the urls that need fixing. Not that this fix works for me when loading a KMZ file as an overlay using the GGeoXml because the image urls I need to fix are in the infowindows that popup from that kml layer (which I guess is why the div has id iw_kml).
You could of course attach to the mousemove event instead and loop through all children of the map div looking for urls to fix. If you look at the API reference (http://code.google.com/apis/maps/ documentation/reference.html) it lists all the events for each type so you could possibly find something better. I was going originally to catch the addOverlay but the ballons are not generated until the user clicks to bring them up so there was nothing to fix when addOverlay was called. Mark On Oct 23, 1:57 pm, epoch <[EMAIL PROTECTED]> wrote: > Mark, > > There's a slight issue with your javascript. It will only work if the > 'resource' that it trying to be loaded is in an info balloon. My main > usage is adding overlays to the map. > > Is there an event that would catch this? > > On Oct 23, 10:06 am, Mark <[EMAIL PROTECTED]> wrote: > > > Barry, thanks for pointing out the known issue - I've starred it so > > lets hope it gets fixed soon. > > > epoch, a servlet to do the redirect seems the most sensible solution > > glad to hear it works easily. > > > For those of us who can't rely on a server side solution though I've > > figured out a simple Javascript solution. Once you have created your > > map object (in a variable called map I would assume) simple add the > > following javascript > > > GEvent.addListener(map, "infowindowopen", function() > > { > > var balloon = document.getElementById("iw_kml"); > > > if (balloon != null) > > { > > var imgs = balloon.getElementsByTagName("img"); > > > for (var i = 0 ; i < imgs.length ; ++i) > > { > > var index = imgs[i].src.indexOf("/mapsatt"); > > > if (index != -1) > > { > > imgs[i].src = "http://maps.google.com" + > > imgs[i].src.substr(index); > > } > > } > > } > > > }); > > > Basically this listens for the info window (aka balloon) being opened > > and then grabs the div in which the content is placed (it has an id of > > iw_kml which hopefully won't change anytime soon) and then looks for > > all images and fixes the src attribute if needed. > > > Hope that helps, > > > Mark --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
