Adding multiple external domains to chrome extension

I am creating a Chrome extension that uses several APIs. I am currently configured in such a way that I can use one of these APIs, but trying to add a second to the manifest will not work. I tried a couple of things, as a result of which the extension does not work or the manifest file is invalid.

"content_security_policy": "script-src 'self' https://domain-1.com; object-src 'self'",
"content_security_policy": "script-src 'self' https://domain-2.com; object-src 'self'"

Provides an invalid manifest error

"content_security_policy": "script-src 'self' https://domain-1.com; https://domain-2.com; object-src 'self'",

Only works for the first domain

"content_security_policy": "script-src 'self' https://domain-1.com, https://domain-2.com; object-src 'self'",

Provides an invalid manifest error

+3
source share
1 answer

There can be only one entry content_security_policy. You can specify multiple domains, but you need to separate them with spaces, not commas:

"content_security_policy": "script-src 'self' https://domain-1.com https://domain-2.com; object-src 'self'",

For details, see the CSP specification , in particular the section.

+7

All Articles