You need to sign in to do that
Don't have an account?
Mohammad Zakir Hossain
Visual force / JavaScript error: Access to image has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I am facing CORS error when accessing image by javascript from visualforce page.
I have already tried adding to CORS whitelisting and remote settings too ..
If I use external image link it works but what ever image use from salesforce content version it shows such error even I tried with sfdc cv public image ContentDownloadUrl.
my use case is exporting image as pdf by html2pdf library .
I have already tried adding to CORS whitelisting and remote settings too ..
If I use external image link it works but what ever image use from salesforce content version it shows such error even I tried with sfdc cv public image ContentDownloadUrl.
my use case is exporting image as pdf by html2pdf library .
Access to image at 'https://...content.force.com/sfc/dist/version/download/?oid=...&asPdf=false' from origin 'https://....visual.force.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Try adding the image as a static resource in your code for fixing the CORS error.
Related:
https://salesforce.stackexchange.com/questions/140693/static-resource-blocked-from-loading-by-cross-origin-policy
https://help.salesforce.com/articleView?id=sf.pages_static_resources.htm&type=5
https://salesforce.stackexchange.com/questions/140693/static-resource-blocked-from-loading-by-cross-origin-policy
If this information helps, please mark the answer as best. Thank you