Postmessage Event


10.0A

 

The Postmessage event is a PL/B Web Server event for the CLIENT object that occurs when a browser 'window' object 'message' event is detected after a JavaScript 'window.postMessage' method is executed. This CLIENT object event communicates data from an iframe to a PWS PL/B event routine. See this link for a description of the 'window.postMessage' method:

 

https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage

Note the following:

  1. The Postmessage event is referenced using an event value of 302. The equated label in PLBEQU.INC for this event is $ClientEventPostMessage.

  2. The Postmessage event data is returned as a JSON string in the ARG1 parameter where the JSON data includes the following JSON field names\data:

  3.  

    Value

    Represents the

    plbevent

    JavaScript field that must exist in the ARG1 JSON data. The value of this JSON field is ignored.

    data

    JavaScript field that contains user specific JSON data.

    origin

    JavaScript field that contains the value which is determined from the 'postMessage' 'targetOrigin' parameter. See the above link for more information on the 'targetOrigin' parameter.

     

Example of JavaScript 'postMessage' in iframe Javascript:

 

parent.postMessage( { 'plbevent': true, 'data': "mydata" }, "*");

 

 Example of ARG1 JSON data:

 

("plbevent": true, "data": "mydata","origin" : "http://www.sunbelt-plb.com:8081"}

 

 

See Also: EVENTREGISTER, Object Events, Object IO Instructions, Object Definitions

 



PL/B Language Reference Paint Event Resize Event