0

I've tried many ways to load a record page using iFrame but it just return a white empty screen.

When I tried to load it with example from Techdicer , it worked. Then I just replaced the url in src attribute with my Salesforce record page https://example-ed.develop.lightning.force.com/lightning/r/Account/0062t000007xxxxxx/view

Html Code

<iframe style="width: 100%; height: 100%"
        src={url}
        scrolling="auto"
        referrerpolicy={referrerPolicy}
        sandbox={sandbox}
        title="Record Page">
</iframe>

LWC Code

@track referrerPolicy = 'no-referrer';
@track sandbox = '';
@track url = 'https://example-ed.develop.lightning.force.com/lightning/r/Account/0062t000007xxxxxx/view';

Thank you

12
  • If you are simply trying to present a record, could you not just embed a lightning-record-form component in your LWC?
    – Phil W
    Commented Jul 13, 2023 at 8:43
  • Hi @PhilW, I would like to display an entire page including the Highlight Panel + Detail Page, etc. Using lightning-record-form can only display record details.
    – Pam
    Commented Jul 13, 2023 at 9:12
  • Won't you also get the header, with global search, app launcher and navigation bar? That'll be a mess...
    – Phil W
    Commented Jul 13, 2023 at 9:20
  • You can use components to show the "highlight panel" and "detail" plus "related lists" if you need all of these. Way better than trying to iframe it in.
    – Phil W
    Commented Jul 13, 2023 at 9:22
  • 1
    Hi @prem22 , I changed it because of privacy matter. I'm sure I use the right url in my real code.
    – Pam
    Commented Jul 13, 2023 at 10:40

1 Answer 1

0

Salesforce does not allow using Iframe to embed a Salesforce record link due to security restrictions and limitations imposed.

Salesforce enforces strict security measures to protect its platform and customer data. One of these measures is the Content Security Policy (CSP), which restricts the types of content that can be loaded within a Salesforce page.

=> There is no solution for this question.

1

You must log in to answer this question.

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