Contents
How to send a message from lightning to iframe?
When you send a message from a Lightning component to the iframe it wraps using contentWindow.postMessage (), there can only be one Visualforce page loaded in that contentWindow. In other words, that Visualforce page is the only place where you can set up a message event listener and get the messages sent by the Lightning component in that fashion.
How to receive window.postmessage even from lightning component?
The best way I found to pass the results is via window.postMessage because the thirda party window and the lightning components are from different domains. The quiestion I have is how to receid that postMessage even from my Lightning component.
When do you send a message from an iFramed Visualforce page?
When you send a message from an iframed Visualforce page to its Lightning component wrapper using parent.postMessage (), parent is a reference to your main window in Lightning Experience where other Lightning components may be loaded.
Can a lightning component receive a Visualforce message?
If other Lightning components loaded in the same window object set up a message event listener, they will receive the Visualforce messages as well. This is a one-to-many messaging scheme, and it’s something to account for both when you send and receive messages.
When to use LMS with VF in iframe?
This communication is preferred when VF pages are present in an iFrame inside a Lightning Component. If VF Pages and Lightning Components are separately present on a Lightning page, then LMS should be the preferred mode of communication. https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html
The framework supports most HTML tags, including the majority of HTML5 tags. We recommend that you use components in preference to HTML tags. For example, use lightning:button instead of . Components are designed with accessibility in mind so users with disabilities or those who use assistive technologies can also use your app.
How to display a VF page inside a lightning component?
Unchecked – Enable clickjack protection for customer Visualforce pages with headers disabled and now the VF page displays in the iframe. The linked post ( https://github.com/salesforcejeff/jargon/blob/master/articles/iFramecomponent.md) gives a wider tutorial, but the code you likely need is below.