Search code examples
javascriptgoogle-chrome-extensionmanifestexternalmanifest.json

Can you have more than one exception in a Manifest's Content Security Policy?


I'm making a browser extension and we need to run some remote js as well as google analytics, but when I put more than one URL into the content security policy we get a Syntax Error.

"content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'", "script-src 'self' https://res.cloudinary.com/givr/raw/upload/v1642726460/coupons.js; object-src 'self'",

Is there a way to allow for multiple external sources in here?


Solution

  • You get syntax error because that is not valid json. You can specify multiple urls separated by space like below.

    "content_security_policy": "script-src 'self' https://ssl.google-analytics.com https://res.cloudinary.com/givr/raw/upload/v1642726460/coupons.js; object-src 'self'"