3.9.17.3Sending messages from the HTML to its creator

The HTML can send messages to its creating widget/script using window.parent.postMessage(). For example:

var html = "<html><body>";

html += "<button onclick='window.parent.postMessage(\"Hello!\", \"*\")'>Click me</button>";

html += "</body></html>";

Framework.ChartChange({

mode: "active", // or "all", or "single" plus a .chartId value

command: "create-html",

options: {

html: html,

}

});

You can receive these notifications from the HTML using an OnMessage() handler, and listening for the CHART_HTML_MESSAGE message type. For example:

// Listen for messages from the HTML

Framework.OnMessage = function(Msg) {

if (Msg.is(FXB.MessageTypes.CHART_HTML_MESSAGE)) {

// Msg.data contains the message from the HTML

}

};