Google Maps API doesn't work with XHTML
Posted by jamie on 03 Feb 2011 in Activity log
So it turns out that the Google Maps API breaks when used on a page served up as XHTML (that is, sent with a content type of application/xhtml+xml). This is because the API itself uses
document.write()
, which isn't available in XHTML. While there's a workaround which involves using AJAX to load the map (this is a good discussion about it), the work required to change the Google maps PHP class that I'm using (view the class) would be significant. Instead, I found a script to emulate document.write()
in XHTML. I'm not sure if this is the 'best' solution, but it's time-effective and doesn't break validation. This entry was posted by Jamie and filed under Activity log.