Howto get iframe linking to internal document source using javascript/jQuery?

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2009-05-29T08:03:30Z Indexed on 2010/06/09 6:12 UTC
Read the original article Hit count: 191

Filed under:
|
|
|

Hi there,

I have an iframe with id "appframe", the source is page.html and it's on the same server. I want to get the source of the page using jQuery.

alert($("#appframe").contents().find("html").html());

returns <head></head><body></body> even though the document does not contain those tags, it only contains "Default page", so that is exactly what it should return. Any idea how to get the right source script of the whole document using jQuery?

Eg. if the document would be "test" then that is exactly what it should return.

Please note: I did ask this before a few weeks ago. Unfortunately, I got no solving answer. Because of my lower reputation (~85), I can not request a bounty... This doesn't make much sense to me. Anyway, it forced me to repost this question.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery