How do you get a <div> from within an <iframe>?
How do you get a <div> from within an <iframe> ?
Share
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.
You could more simply write:
and the first valid inner doc will be returned.
Once you get the inner doc, you can just access its internals the same way as you would access any element on your current page. (
innerDoc.getElementById…etc.)IMPORTANT: Make sure that the iframe is on the same domain, otherwise you can’t get access to its internals. That would be cross-site scripting. Reference:
<iframe>Scripting