I cannot resolve the following error:
"DOMException: Permission denied to access property "document" on cross-origin object" when i do this ::
const iframeELE = document.getElementById('pdfIframe') as HTMLIFrameElement;
const iframeELEcont = iframeELE.contentWindow;
if(iframeELEcont){
const iframeELEcontDOC = iframeELEcont.document;
}
It is an iframe that has a .pdf loaded and I want to obtain its content after modifying that .pdf with a visual signature or picture.
Thanks a lot!
edited: I think I perform the operation within the same domain or its subdomains. I try to explain it better: It's my own server running an app to upload files, show them into the iframe (until this i got), and next i want to sign this files and save again in the server.
I use firefox browser, that is the unique that allows me the option to sign with the iframe.
Clicking the iframe button 'save as...' it works well but i am trying to make my own button to save the .pdf file on my server, without pass the window 'save as...'.
the output from firefox console
I hope i can explained. thanks!
CORS (Cross-Origin Resource Sharing) is a security policy that prevents domains from being accessed or manipulated by other domains that are not allowed. I assume you are trying to perform an operation from a different domain.
There are three ways to avoid being blocked by this policy:
The domain you are trying to manipulate explicitly allows your domain to run its scripts.
You perform the operation using a local script or a browser with CORS disabled (e.g., a CORS-disabled Chrome).
You perform the operation within the same domain or its subdomains. You can test this easily in the browser console via the inspector.
Here is a useful link that addresses a similar problem:
Error: Permission denied to access property "document"