1

I'm trying to build a component utilising lightning:component (external build) which has a dependency that loads code on init via a script tag. Specifically I'm trying to load content from https://maps.googleapis.com

I've followed https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/container_csp.htm and put the following in my manifest.json file:

{
    "landing-pages" : [
        {
            "path": "index.html",
            "content-security-policy-type": "custom",
            "content-security-policy": "default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' maps.googleapis.com fonts.googleapis.com"
        }
    ]
}

It appears as though the unsafe-inline statement works for fonts.googleapis.com, however the unsafe-eval for maps.googleapis.com doesn't work. Does lightning reject some of the custom CSP I have supplied?

Side note: I'll update the sources to https://maps.googleapis.com for example once I get this working, but for now I thought I'd let it be open just incase it causes other issues.

Apart from this, has anyone else had any luck with embedding google maps inside lightning? I haven't tried a VF solution yet, but want to avoid for legacy sake, and I feel the CSP would stop this anyway. Also, am tempted to raise a case with SF for this, but don't want to spend weeks getting the run around.

Your Answer

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

Browse other questions tagged or ask your own question.