Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

116
Views
Change div style inside iframe react

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.
enter image description here

Is there any way to select the div in react ? I have tried using contentWindow and still its not working.

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

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

7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs