We actually switched the way we perform santiziation with 1.7, so nothing is actually stripped out from the HTML anymore (it’s all handled at the browser level depending on the Infobox.frame.sandbox configuration).
The long term goal for Cesium is to be able to automatically detect and load any extra data provided via CZML. So if you add an extra property to your CZML packet, it “just works”. We haven’t had time to get to this considering everything else going on. In the mean time, it’s still possible and you can easily wire this up manually.
The extremely simple case is if you just have some static data you want to associate with an entity. The below example shows you how to do that.
//Create a custom CZML processor and add it to the list of CZML updaters at startup.
function customCzmlProcessor(entity, packet, entityCollection, sourceUri) {
var myCustomData = packet.myCustomData;
if (!Cesium.defined(myCustomData)) {
return;
}
if(entity.propertyNames.indexOf(‘myCustomData’) === -1) {
entity.addProperty(‘myCustomData’);
}
entity.myCustomData = myCustomData;
}
Cesium.CzmlDataSource.updaters.push(customCzmlProcessor);
//End code at start of app
//Example of it in action. I hardcoded a CZML object here, but it will work with a url too.
Cesium.CzmlDataSource.load([{
id : “document”,
version : “1.0”
}, {
myCustomData : {
foo : 1,
bar : “value”
}
}]).then(function(dataSource) {
//Entity now has a myCustomData property!
alert(dataSource.entities.values[0].myCustomData.foo);
});
It’s also possible to add custom time-dynamic CZML properties too, if that’s what you want, take a look at processBillboard in CzmlDataSource.js, it’s similar to the customCzmlProcessor above, but it uses Cesium.processPacketData for the properties instead of direct assignment.