It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Getting IFrame contents

Getting IFrame contents

Postby barrydrez on Wed May 10, 2006 5:56 pm

Hi - I have an IFrame within an html document that is linked to an external html file. The frame correctly renders the html from the external file. What I would like to do next is retrieve the contents of the IFrame and display it (for the time being in an alert dialog). For some reason, all I can display is the html for the parent page. I'll be happy with just the rendered output if that is possible. I am using IE6. Here is the code:
Code: Select all
<html>
<script type="text/javascript">

function showcontents() {
  alert(document.getElementById('dummyIFRAME').document.body.innerHTML);
}

</script>

<BODY TEXT="#000000" BGCOLOR="#FFD700" LINK="#FFFF00" ALINK="#33FFCC" VLINK="#FF3333">

<br>
<input onclick='javascript: showcontents()' type='button'
value='show'></input><br><br><br><br><br><br><br><br>
<iframe id='dummyIFRAME' name='dummyIFRAME' src="http://online.kitco.com/scripts/cgi-bin/texten.pl"></iframe>
</body>
</html>


Thanks for any help - Barry
barrydrez
 
Posts: 2
Joined: Wed May 10, 2006 5:48 pm

Postby DrAmbar on Mon Sep 04, 2006 10:08 am

Hi Barry,
Yes, innerHTML would get the original text in the document and naturally not the contents of the url it references.
In my opinion, what you are attempting (grabbing the content of another webpage into the javascript of this page) may not be possible.
Ambar
DrAmbar
 
Posts: 2
Joined: Mon Sep 04, 2006 9:30 am

Postby barrydrez on Tue Sep 05, 2006 11:46 am

Thanks, Ambar.
barrydrez
 
Posts: 2
Joined: Wed May 10, 2006 5:48 pm


Who is online

Users browsing this forum: No registered users and 7 guests