Sample Code
The HxGN Smart Sites Client application can be embedded via the iframe tag
<iframe id="hss-app" src="https://hss-client.com"></iframe>
The host application can send messages to the embedded application via the postMessage API:
const iframe = document.getElementById( "iframe" );
iframe.contentWindow.postMessage( message, origin );
The host application can listen to messages coming from the embedded application by registering an event listener on the window:
window.addEventListener("message", (event) => {
if (event.data.type === "ready") {
console.log( "HxGN Smart Sites Client is ready to receive messages." );
}
});