Salesforce Refused to run the JavaScript URL because it violates the following Content Security Policy directive: script-src ‘self’ Exception

Salesforce Refused to run the JavaScript URL because it violates the following Content Security Policy directive: script-src ‘self’ Exception

Refused to run the JavaScript URL because it violates the following Content Security Policy directive: script-src ‘self’ Exception is thrown in Salesforce when external JavaScript libraries are accessed.

To use script-src ‘self’ directive, the External JavaScript libraries should be uploaded into a Static Resource and it should referenced in the Salesforce Components.

In Lightning Aura component, we can use tag to refer the External JavaScript libraries.

Reference Article:

https://developer.salesforce.com/docs/atlas.en-us.232.0.lightning.meta/lightning/security_csp.htm

Leave a Reply