Highlighted

How Do I Allow Cross-Origin Requests for View SDK

New Here ,
May 08, 2020

Copy link to clipboard

Copied

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.

Topics

Creative Cloud

Views

69

Likes

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

How Do I Allow Cross-Origin Requests for View SDK

New Here ,
May 08, 2020

Copy link to clipboard

Copied

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.

Topics

Creative Cloud

Views

70

Likes

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

Have something to add?

Join the conversation