Forum Moderators: open

Message Too Old, No Replies

Having Problem Transferring "InnerText" From IFrame Web Page

IFrame InnerText To TextArea Transfer

         

Dualsporter

6:07 am on Oct 30, 2003 (gmt 0)


Simple example page script below followed by problem.
______________________________________________________

<HTML>
<HEAD>
<script language="javascript">

function Transfer(){
document.form1.IText.value = X_Name.document.body.innerHTML;}

</SCRIPT>
</HEAD>

<body>

<iframe name="X_Name" src="http://www.test_url.com/" style="height:400px; width:700px;">
</iframe>

<P>
<input type='button' onClick="Transfer();" value="Transfer">
<BR>

<form name="form1">
<textarea name="IText" rows="12" cols="46" readonly>
</textarea>
</form>

</BODY>
</HTML>
______________________________________________________

I want to be able to strip the HTML of an active webpage (Address to be located in IFrame descriptor. Currently "http://www.test_url.com/"[smilestopper]) residing inside the IFrame.

Works fine for a "test" page saved to my local system, but gives me an "Error On Page" warning when I try with same page off of web.

Any thoughts would be greatly appreciated.

Dualsporter

MonkeeSage

7:06 am on Oct 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My guess would be because the site in the iframe is on a different domain from the page hosting it...XSSS (Cross-Site Scripting Security) is a big problem area, so most browsers don't allow you to access properties like innerHTML for an iframe from a different domain.

Beside that, you could try changing...

X_Name.document.body.innerHTML;

to...

window.frames['X_Name'].document.body.innerHTML;

But I really think it is a XSSS issue.

Jordan