Debugging KML Balloon Content in Google Earth
February 9th, 2012 | Published in Google Maps
KML Balloons in Google Earth - starting with version 5.0 - support HTML, CSS, and almost full JavaScript. This can be a great tool for developers looking to add rich content and interactivity into their KML files.
However, it’s not always obvious how to debug that KML content. Google Earth doesn’t have a full set of tools like Chrome Developer Tools. However, it does allow you to view console output, so console.log() output, as well as errors that would normally appear in the Chrome console or Firebug will appear in the console instead. Note, Google Earth does not allow the presentation of system dialogs (namely the functions alert, confirm, and prompt).
Here’s some quick tips on how to get it to work:
- Linux: Launch Google Earth from the terminal window. Console output will then appear in the terminal window.
- Mac OS X: You can launch it directly from the command line, “/Applications/Google Earth.app/Contents/MacOS/Google Earth” and read the console output in the command line.
- Windows: Install DebugView, which is from Microsoft, and look for system messages in the output.
Here's a screenshot from Mac OS X:
Balloon content is rendered by WebKit, and Google Earth currently supports the equivalent of Safari 4.0.4 (which is WebKit-based). If you want to know if a particular JavaScript or CSS feature is supported, one option is to search for it on http://caniuse.com/.