views:

502

answers:

1

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" - any idea how to get the right source of the whole document, including (when existing) etc. using jQuery?

A: 

Try this...

var frame = $("#appframe").get(0);
var $doc = $(frame.document.documentElement);
alert($doc.html());
great_llama
I'm afraid that returns:frame.document is undefined[Break on this error] var doc = $(frame.document.documentElement);
Tom