[SalesForce] Iframe content not displaying in Salesforce community

I'm updating the iframe URL in a Lightning component that our Community uses with a new URL to point to a public microsite that the Marketing department created. However, the iframe content isn't displaying the microsite content:

enter image description here

I added the microsite URL to CPS Trusted Sites in Salesforce, but that didn't resolve it. Any idea why the iframe can't load the content?

Best Answer

Check the X-Frame-Options header of the framed content to make sure that it is allowing you to embed it in an <iframe> first. If the content has the header set to X-Frame-Options: DENY then you won't be able to frame the content.

If you don't see that header value for the framed content, make sure you also check the "Allow site for frame-src" option in your CSP Trusted Site Definition. Additionally, make sure you also check the community-specific CSP in the Experience Builder as well.

Related Topic