Communication between Lightning Web Component and Visualforce Pages in Salesforce | LWC Stack ☁️⚡️

Поділитися
Вставка
  • Опубліковано 18 жов 2024
  • In this blog I will show you how you may communicate between LWC to VF page and vice versa.
    Visualforce page and Lightning Components can coexists, while communicating between them you need to take care of few things.
    Different DOM Elements : As the visualforce page will be in an iframe so the DOM elements of the Lightning Component and VF page will be different. And also the window object will be separate for VF page.
    Different Origin : Visualforce page and Lightning Components are having their different origins. For lightning component it will be ending with lightning.force.com and for visualforce pages it will be ending with visualforce.com
    Now the question is why it's difficult to communicate with different origin pages?
    Answer : It is due to browsers Same Origin Policy, this prevents page to pass or receive code/data from a different origin page.
    This is due to security reasons. But fortunately we are having an API to do this securely.
    To do this we will be using window.postMessage()
    #Salesforce #lwc #Visualforce
    Join me on Instagram : / iamkapilbatra
    Blog : www.salesforce...
    Website : www.salesforce...​​
    LinkedIn : / salesforcebolt
    Twitter : / salesforcebolt​​
    Facebook : / iamsalesforcebolt

КОМЕНТАРІ • 4

  • @GauravSharma-hx6rz
    @GauravSharma-hx6rz Рік тому +1

    Is it possible to communicate between two different Salesforce org using EventListener?

    • @SalesforceBolt
      @SalesforceBolt  Рік тому

      I think it is only possible if the 2nd org's page is also embedded in the first one using .

  • @rajshudilpvtltd
    @rajshudilpvtltd 11 місяців тому

    for security purpose document cannot read.. please provide solution