We have a VF page. From that page, we are trying to download standard Salesforce attachment using XMLHttpRequest in javascript. We are doing GET request with attachment download URL as the endpoint. But unfortunately, we are getting error "Access to XMLHttpRequest at [endpoint] from origin [Visualforce URL] has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource". We also added endpoint as CSP and visualforce page URL as CORS in the Salesforce. But still getting same error.
remoteFunction
which acts a s a server side proxy. developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/…