HTML, CSS, JS, etc embedded in Balloon

606 views
Skip to first unread message

blab123xc

unread,
Aug 27, 2010, 6:13:13 PM8/27/10
to kml-support-g...@googlegroups.com
I have a series of 5 or so networked KML files that get called when my page loads.

I'd like the balloons that pop for each KML file to be able to display html, css, javascript, etc.

A few of the placemarks in one KML will display images or links when clicked.  Those work fine.  Data source is the description field. <img> and <a> doesn't get "scrubbed" evidently.

Without manipulating the KML files, is there a solution that will allow the descriptions in all of the network linked KML files that load to be treated as html?

Thanks.

Geobrowser

unread,
Aug 28, 2010, 3:49:36 AM8/28/10
to KML Developer Support - Getting Started with KML

> Without manipulating the KML files, is there a solution that will allow
> the descriptions in all of the network linked KML files that load to be
> treated as html?


Not entirely sure what you mean by this but Webkit (the open source
web browser engine used by GE) should render most HTML5, JS, CSS in a
description balloon in the same way as they do in any browser. There
are few quirks, e.g., <video> is broken right now, some JS alert
dialog boxes wont show, etc. You can read details here:
http://code.google.com/apis/kml/documentation/kmlreference.html#description

But as long as you're including CDATA, then the GE parser will leave
the contents between the description tags along:

<description><![CDATA[ .....all your HTML, JS , CSS goes here...]]></
description>

JB

blab123xc

unread,
Aug 30, 2010, 12:11:44 PM8/30/10
to kml-support-g...@googlegroups.com
I can create a kml with video, iframes and any other HTML in the file <description> no problem.  The contents display as expected in Google Earth (desktop).  But when i view those KML files via a web browser....that's when im running into problems with "scrubbing". --> http://code.google.com/apis/earth/documentation/balloons.html#scrubbing

Is there anyway to get around this scrubbing when a KML is served via a web page? 

Geobrowser

unread,
Aug 30, 2010, 6:05:15 PM8/30/10
to KML Developer Support - Getting Started with KML
Ah okay, that makes more sense. There are few different ways to make
video, JS, etc appear if you manipulate the Earth API code, but it
sounds like you want the KML to be displayed by calling an external
file. In this case I don't know of way round the security scrubbing.

As this is an API related issue its probably a question better asked
in the "Google Earth Plug-in" group rather than "getting Started with
KML", there might be some folks there with some ideas.

JB
Reply all
Reply to author
Forward
0 new messages