HighDots Forums  

Re: Getting HTML Contents of a Frame

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: Getting HTML Contents of a Frame in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peter Michaux
 
Posts: n/a

Default Re: Getting HTML Contents of a Frame - 06-17-2007 , 01:31 PM






On Jun 17, 7:01 am, "DRS.Use... (AT) sengsational (DOT) com"
<DRS.Use... (AT) sengsational (DOT) com> wrote:
Quote:
On Jun 15, 10:44 am, "DRS.Use... (AT) sengsational (DOT) com"



DRS.Use... (AT) sengsational (DOT) com> wrote:
When I run
Code:
alert("page contents:" + content.document.documentElement.innerHTML);

I am able to pull the content. I see something like this

Code:
page contents:<head><title>A Title</title FRAMESET ROWS="75,*" FRAME SRC="sample2.html" NAME="nav" title="Main Navigation" FRAME SRC="sample.html" NAME="body" title="Main Content" /FRAMESET

What I want to get is the HTML inside of one of the frames,
specifically "sample.html".

I am able to get to an HTMLFrameElement object using
"content.document.getElementsByName("body")[0]", but have not been
able to grab the content, and I'm not so sure that's the right path to
be taking to get the content.

The property I was looking for was "contentDocument". Here is the
solution:

content.document.getElementsByName("body")
[0].contentDocument.documentElement.innerHTML

which I was able to assemble once I found the "right" API
documentation here:http://www.xulplanet.com/references/...DOMHTMLFrameEl...

There seems to be problems getting the document object of a frame.
About half way down this page...

<URL: http://developer.apple.com/internet/webcontent/iframe.html>

Peter



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.