In this example, we will take example code that sends a message from the Lightning Component to the Visualforce page. Note that we use the postMessage feature of JavaScript for this communication.
The code snippet for the Lightning Component is as follows:
<aura:component implements="flexipage:availableForAllPageTypes" access="global"> <aura:attribute name="vfHost" type="String" default="computing-inspiration-8620-dev-ed--c.cs62.visual.force.com"/> <!-- Input field for message "data" --> < Lightning:button label="Send to VF" onclick="{!c.sendToVF}"/> <div> <!-- The Visualforce page to send data to --> <iframe aura:id="vfFrame" src="{!'https://' + v.vfHost + '/apex/testVF'}" ...