J.P. Larocque (jp_larocque) wrote,
J.P. Larocque

  • Music:

Google Maps API and XHTML

Everyone knows Google Maps. Google also has their stuff opened-up to third-party developers looking to visualize maps. You load magic Javascript from Google's servers, say you'd like to create a GMap (or whatever it's called) object, rendering to some element, and now you've got your own map. You can ask the map component to go to some location, or to overlay a sequence of connected line segments over the map, or do any of several surely much cooler things.

Old news.

Google encourages you to use XHTML, rather than HTML, for your Maps-utilizing web app. But they didn't seem to think that decision through very well—if your "XHTML" page is sent as a "text/html" document, all is well. But then your browser reads this jibberish in as tag-soup HTML. XHTML should be served as "application/xhtml+xml".

Google Maps uses legacy techniques, like document.write, in their Javascript, which break in Firefox—IF the document it came in was marked as pure-XHTML "application/xhtml+xml". And can you really put Firefox in the wrong there? You have to lie about the Content-Type of your page and say it's "text/html" for anything to work.

So, what was the point of encouraging XHTML again?


Tags: google, google maps, web, xhtml
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.