0

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 May 26 '20 at 17:12
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.