Is there a way to access this iframe and change its content?
Yes, via browser messages if you are able to and back from it, via postMessage. However iFrames are built with security in mind and sandboxing is one way that is done.
it gets loaded from the external server src.
If you can postMessage to the iframe from here, listen for it in the iframe / app, tell the app to get the data you need and post it back to the external server - that's how we are working with iframes, but its frontend not server side, if its server side... there must be another solution.
--disable-web-security
on the iframe sandbox is one flag you can play with, but it is not recommended.
The “Same Origin” policy states that:
- if we have a reference to another window, e.g. a popup created by window.open or a window inside , and that window comes from the same origin, then we have full access to that window.
- otherwise, if it comes from another origin, then we can’t access the content of that window: variables, document, anything. The only exception is location: we can change it (thus redirecting the user). But we cannot read location (so we can’t see where the user is now, no information leak).