This is most likely possible, but I want to style the main page using CSS while all I have access is a sandboxed iframe child. Please note that the child iframe is on a different subdomain than the parent.
Can this be done? and how?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t believe this is possible because the child frame is on a different subdomain. This violates the Same origin policy, and as a result, and Javascript in your frame should not be able to access the parent page, nor will any CSS selectors you apply inside your child frame.
If you’re in control of both pages on the different subdomains, you can try setting the
document.domainproperty to your common domain name. This should allow the two pages to access each other via Javascript, which would allow you to invoke methods in the parent page. I’ve actually tried this in the past unsuccessfully, so I’m not sure where I went wrong. More info about document.domain.