Skip to main content
Participating Frequently
May 8, 2020
Question

How Do I Allow Cross-Origin Requests for View SDK

  • May 8, 2020
  • 1 reply
  • 633 views

I have created my API and Credentials for View SDK to use on my website.  I am using this code snippet I found in the example format I would like to use:

 

<script src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
	<script type="text/javascript">
	document.addEventListener("adobe_dc_view_sdk.ready", function(){ 
		var adobeDCView = new AdobeDC.View({clientId: "<redacted>", divId: "adobe-dc-view"});
		adobeDCView.previewFile({
			content:{location: {url: "https://www.shcsfarmington.org/2020/news/Newsletter_050420.pdf"}},
			metaData:{fileName: "Newsletter_050420.pdf"}
		}, {});
	});
	</script>

 

The viewer does appear in my web page when the script is invoked, but the content does not.  The error I get in the web developer console is this:

"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at < URL redacted>. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing)."

I realize that some security setting is missing somewhere, but after extensive Google searching I can't seem to figure out where or how to fix the issue.  I would appreciate any help with detailed instructions.

Thanks.

This topic has been closed for replies.

1 reply

Known Participant
June 30, 2022

you have to provide access to your bucket. By access i mean you have to set the cors policy of your bucket or whatever third party storage you are using to store pdf.