Communication between the Lightning main frame and iframe

Your Lightning app may also include applications that are designed in Visualforce. Visualforce was used in the Salesforce classic experience before Lightning existed.

In this section, we will explore how can we communicate between a Visualforce iframe and a Lightning Component. Note that we have used Visualforce here, but technically one could use this approach to communicate between a Lightning window and any iframe loaded in the Lightning page. Use only unsecured data between frames, since the postMessages API that we use to communicate does not offer security.

This technique uses the postMessage API to do the communicating. You can read about postMessage at https://developer.mozilla.Org/en-US/docs/Web/API/Window/postMessage ...

Get Learning Salesforce Lightning Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.