function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Avish Samdani 5Avish Samdani 5 

I am getting CSP error while embed a component using salesforce Canvas app.

I have created one lightning component. The lightning component is rendering the canvas app content. Cacnvas app content is loading perfectly. In the canvas app there is button, On click of that button they are opening the content in i-frame. When I click button I am getting the following error:
Refused to frame "IFrame content URL" because an ancestor violates the following Content Security Policy directive: "frame-ancestors Canvas app url".

Is there any configuration we need to change in salesforce. As far as I know this is blocking by CSP.
VinayVinay (Salesforce Developers) 
Hi Avish,

Check steps mentioned below and try to disable clickjack under setup-->session settings.

https://help.salesforce.com/s/articleView?id=sf.csp_trusted_sites.htm&type=5
https://salesforce.stackexchange.com/questions/262697/content-security-policy-error-while-loading-apex-iframe

Please mark as Best Answer if above information was helpful.

Thanks,
Avish Samdani 5Avish Samdani 5
Hi Vinay,

Thank you for your response. I already try to disable clickjack & I have also added URL in CSP trusted. But It didn't work for me.