I have created one Lightning Component, and loading that from one Visualforce page. When I click on a button in Lightning Component, I am showing another Visualforce page as a Modal (popup) by using an Iframe. We can close that Modal by using an 'X' icon, which is calling the "CloseModal" method. That is fine.

Now, I aim to close the popup by using the Esc keyword. So, when I press Esc on the Visualforce page, it should call the "CloseModal" method.

I can communicate to the Lightning component from the VF page (from where I am loading the component) through "aura: method". But, I am unable to call the "CloseMethod" from VF Page, which has embedded in an iframe (Modal).

How can I achieve this?

Any thoughts would be appreciated!

Thanks Sannith

  • Have you looked at Lightning Messages as a solution to this situation? This new framework is designed to allow VF->LC communication, even across frames or windows, and may be what you're looking for.
    – sfdcfox
    Commented May 26, 2020 at 17:12

1 Answer 1


I have tried with parent.postmessage in VF page and event listener in Component, this has resolved my issue.

For more details: Visualfore page to Lightning Component

Thank you

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .