Created your code in a script: http://jsfiddle.net/mdares/TAfys/
I cannot reproduce the problem you are facing. Can you give an example above where it fails? Is this possible in the browser? Finally - is there any additional code that you have not published that could be the reason? My code is immutable from yours as you posted, but I am curious if you also do other things:
function initialize() { var mapOptions = { center: new google.maps.LatLng(41.875696, -87.624207), zoom: 11, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); var ctaLayer = new google.maps.KmlLayer('https://sites.google.com/site/anoopkml123/kml/ab9Plan0520.kmz'); ctaLayer.setMap(map); google.maps.event.addListener(ctaLayer, 'click', function (kmlEvent) { alert(kmlEvent.featureData.name); }); }
source share