Embedded mode (iFrame)

The renderer can be embedded in other applications via an iFrame and controlled via it.

Window is used for communication with the renderer in the iFramehttps://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage[.postMessage] is used. All Functions also send responses in this way to the application that embeds the renderer via iFrame.

Function call

A serialized JSON object is transmitted as message Parameters.

action

Name of the function to be called Function.

payload

Depending on the action, this attribute is used to specify a parameter object that contains further data.

sourceId

Freely selectable ID. This is used when transmitting the Function result as destinationId. This allows the caller to uniquely assign the result.

Structure function call
{
  "action"  : "METHOD_NAME",
  "sourceId": "SOURCE_ID",
  "payload" : {
    "_comment": "optional object depending on method"
  }
}

Function result

The result of the function call Function call is transmitted asynchronously via Window.postMessage to the embedding page.

Structure function result
{
  "success"  : "SUCCESS_OF_ACTION",
  "action"   : "METHOD_NAME",
  "destinationId" : "SAME_AS_SOURCE_ID",
  "response"      : {
    "_comment": "optional response object"
  }
}

Functions

All actions valid in the Forms context are transmitted to the caller Actions can be used. For example:

{
  "action"  : "setFormState",
  "payload" : {
    "data"  : { "welcomeMsg"  : "Dies ist eine neue Nachricht" }
  }
}

With the response that the function could be called successfully:

{
  "success" : true,
  "action"  : "setFormState",
  "destinationId" : "*",
  "response": {}
}

Keywords: