I am working in a next js project and have implemented an iframe inside a component. Problem is I want to change the style of the div inside the iframe which loads after the iframe is rendered in the component. I am unable to select the div with id "embed" inside the iframe.
Is there any way to select the div in react ? I have tried using contentWindow and still its not working.
There is no way to access the content of an iframe if the document in the iframe is from a different domain. This is by design.
Read about Cross-origin script API access on MDN: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#cross-origin_script_api_access