Take the 2-minute tour ×

To put it simple, I have some placemarks in KML file, if I load this KML, then click on Placemark - balloon will show.
If i remove that KML, placemark is gone, but balloon still showed.
Anyway to make it close?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

This should do the trick to close any open balloon:

share|improve this answer
if execute it at kml removing, this really close any ballon, but what if opened balloon wasn't belonged to removed kml? i want to keep opened balloons of other kml opened –  Kosmos Aug 12 '12 at 8:33
You probably need to keep track of which balloon is open, in that case. For example, you can listen to a balloonopening event and check the content of the balloon (or just check it before potentially closing) to see if it matches your criteria for your specific KML. Otherwise there is no way I'm aware of to directly relate which KML may have caused the balloon to open.that I am aware –  jlivni Aug 13 '12 at 16:36
thanks, this is at least something :P but code example how to listen balloon opening event would be also good –  Kosmos Aug 14 '12 at 7:16
google.earth.addEventListener(ge, 'balloonopening', myFunction); –  jlivni Aug 14 '12 at 16:00
thanks, probably this is what i need :) –  Kosmos Aug 14 '12 at 16:19

Your Answer


