0

When I am adding script in Lightning Salesforce App. I have got this error given below

Error :

Content Security Policy: The page's settings blocked the loading of a resource at https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js ("script-src https://bappi--davidtest.lightning.force.com chrome-extension: 'unsafe-eval' 'unsafe-inline' ).

Please provide your suggestion.

1

2 Answers 2

1

Better option is download https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js this js file upload into static resource

and use ltng:require for load static resource. once static resource loaded acll your init function from afterScriptsLoaded

<ltng:require scripts="/resource/resourceName" afterScriptsLoaded="{!c.init}" />

This will solve your problem

2
  • I have already done. But I have got same error. Dec 1, 2015 at 6:43
  • whats the error?
    – Ratan Paul
    Dec 2, 2015 at 16:35
1

You may add the Javascript URL domain to CSP trusted Sites from Salesforce Setup.

For a step by step guide you can make use of the below link : https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/csp_trusted_sites.htm

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.