0

I have a mostly blank HTML page, that links to an iframe. The iframe page contains some text and 2 buttons tied to onclick scripts. I want to click the buttons, but I'm not able to get the values of getboundingclientrect when I supply the ID. How can I get the value of getboundingclientrect for an element (button) inside the iframe page in IE9?

Thanks for looking.

EDIT: made question more specific

0

2 Answers 2

3

Like this, if it is the same domain. If it is a different domain, it won't work.

var myIFrame = document.getElementById('iframename'); var content = myIFrame.contentWindow.document.body.innerHTML; 

A different domain would be:

Parent: www.test.com Child: sub.test.com or Child: www.testpage.com 

It has to do with the same origin policy

Sign up to request clarification or add additional context in comments.

1 Comment

by domain, you mean both pages belong to the same foo.com?
0

As long as you're not doing something with a cross domain scenario this will work cross browser.

function getIFrameDoc(frame) { return frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document; } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.