W dniu 02-09-2011 18:25, John L. pisze:
> Is it possible to access the HTML source of a page that is loaded in
> an IFRAME via JavaScript in the top-level page? I thought something
> like this would work:
>
> <HTML>
> <IFRAME id="myIFRAME" src="B.html"></IFRAME>
> <SCRIPT>
> var a =
> window.document.getElementById("myIFRAME").documen t.body.innerHTML;
> </SCRIPT>
> </HTML>
>
> to get the HTML source of B.HTML into a JavaScript variable, but alas,
> no luck.
>
> Can anyone offer any guidance? Thanks in advance.
I would try:
var iframeObj = document.getElementById('my_iframe_id'),
doc = (iframeObj.contentWindow || iframeObj.contentDocument),
body, content;
if(doc.document)
{
body = doc.document.getElementsByTagName('body')[0];
content = body.outerHTML;
}
For Firefox try to find equivalent, for example:
http://www.velocityreviews.com/forum...n-firefox.html
--
Peter