• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Content Security Policy - Embed API JavaScript Promise

Community Beginner ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

I have been using the API and providing a URL and not having any problems but when I switch to using the promise I am getting an error back in the console and the file doesn't load. It looks as if the error is in the viewer.js 

 

I get the error:

"Refused to execute inline event handler because it violates the following Content Security Policy directive: "script-src 'self' use.typekit.net assets.adobedtm.com www.adobe.com/marketingtech/ prod.adobeccstatic.com/utilnav/ widget.uservoice.com by2.uservoice.com/t2/ assets.adobe.com api.demandbase.com/api/v2/ip.json commerce.adobe.com". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present."

DeanWa_0-1675433655626.png

 

Is there something I need to add to my CSP Header to prevent this?

 

To reproduce the error here's what I am doing using I am using https://documentservices.adobe.com/view-sdk/viewer.js 

 

var adobeDCView = new AdobeDC.View({
clientId: {clientId},
divId: "adobe-dc-view",
});

adobeDCView.previewFile({
content: {
promise: readFile(buffer),
},
metaData: {
fileName: "FileName"
}
}, {});
}

 

Any help would be greatly appreciated.

TOPICS
PDF Embed API

Views

720

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 25, 2023 May 25, 2023

Copy link to clipboard

Copied

LATEST

Hi @DeanWa, did you manage to fix this issue?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources