I am currently using a visualforce page inside a lightning component.Is there any way to set the parent lightning component attribute from visualforce page or send data to the lightning component from visualforce page?


The only official mechanism for this sort of communication is the Lightning Message Service.

Note that you cannot directly embed a Visualforce page within an LWC. The best you can do is to use an iframe with the URL for a Visualforce page inside the LWC.

However, since URLs for the two different types of page (lightning vs visuallforce) cannot be programmatically determined within the same context due to a lack of any API to do so, I strongly recommend against such an approach and feel you should simply include both a Visualforce page and an LWC that interacts with that page via LMS in the same Lightning Page. I.e. the components are simply siblings on the page.

  • Sorry but I don't quite understand, I am trying to use visualforce inside the aura component, not the other way around. – adnan_aust Nov 25 '20 at 2:32
  • Apologies, I initially misread your question. Answer updated. – Phil W Nov 25 '20 at 7:40

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.