Posts

Showing posts with the label infowindow

Google Maps InfoWindow Problem

Image
I'm not sure what went wrong here, but Google Maps infoWindow seems to have stopped working in one of the API release. At least, it stopped working in the way that it used to. As is often the case, the fix was a simple one.  The symptoms I was getting was the info window seeming like it was appearing off the top left of the map when I had :- google.maps.visualRefresh = true; or not appearing at all if this was false.  No errors.  If I popped an alert into the click addListener, the alert popped up.  It looked like this for me :- In the end, it seems that one can no longer assign a value to the infoWindow's "content" property :- var infoWindow = new google.maps.InfoWindow(); infoWindow.content = "Some HTML"; This just failed.  Instead, a subtle change :- var infoWindow = new google.maps.InfoWindow({content:  "Some HTML" }); Worked perfectly. I had done all sorts before like trying to alter the scope of variables.  I'd even ...

Google Maps InfoWindow Not Displaying

Had a weird scenario where two mapping sites stopped working.  They use Google Maps API version 3.9 and are currently static (ie there were no current changes being made to the site).  One day, the InfoWindow used to display information about a google marker stopped displaying the info window.  No script errors, nothing had changed in code for 3 or 4 months, and had been working fine until then. I finally tracked it down and changed the following line :- goInfoWindow.content = tsLabel; and instead wrote it as :- goInfoWindow.setContent(tsLabel); and the InfoWindow then works fine. I was unable to find others experiencing this problem, and couldn't see any notes on Google's site.  I thought I would post this so that others might find it and benefit.  Why using the infoWindow.content property would stop working, I have no idea.  At least infoWindow.setContent works without too much extra effort.