Link to home
Start Free TrialLog in
Avatar of garthmiller
garthmiller

asked on

innerHTML of frame with an FTP location?

I need to access the "document.body.innerHTML" of a frame when the frame location is an ftp site.

I can do it as long as the location of the frame is an http page, but when I make it an ftp site, the frame no longer has a "document" object.

Here is the code that is giving me problems:

** Main Frameset Page **
<html>
<head>
<script language="javascript">
<!--
function logon(user,pw,server) {
  bottomframe.location = 'ftp://' + user + ':' + pw + '@' + server;
  return;
}
function check() {
  alert(bottomframe.document.body.innerHTML);
}
//-->
</script>
</head>

<frameset name="frameset" rows="*,100">
  <frame name="topframe" src="logon.html">
  <frame name="bottomframe" src="blank.html">
</frameset>


** logon.html Page **
<html>
<head>
</head>
<body>
<form name="logonForm" action="SelectPage.html">
<b>Logon to Web Site</b>
<br>
Username:<input name="username" type="text">
<br>
password:<input name="password" type="password">
<br>
Web Server:<input name="server" type="text">
<br>
<input type="button" value="Logon" onClick="parent.logon(document.logonForm.username.value,document.logonForm.password.value,document.logonForm.server.value);">
<br>
<input type="button" value="Show innerHTML" onClick="parent.check();">
</form>
</body>
</html>

** blank.html Page **
<html>
<head>
</head>
<body>
The innerHTML is here
</body>
</html>
Avatar of third
third
Flag of Philippines image


"I can do it as long as the location of the frame is an http page"

not all http page but only pages that you own or pages that grants you full access. try setting the bottom frame to www.yahoo.com and see what i mean.

this also applies to your problem.
Avatar of stevenmoffat
stevenmoffat

Ive read through the script

Can you give broad outline of what you are trying to acheive??

Im assuming you want authorised users the ability to download certain files????

steven M
Avatar of garthmiller

ASKER

third:

You are right (although the error message for pages that I don't own says "access denied" instead of "no such interface supported" which is what it says for ftp pages).

steven M:

You are right, I want to make an HTML editor using javascript.  This means I need the browser to be able to upload and download files.
www.spidergen.com

cost about uk £250 for studio version and £100 for normal client, this does what you want to do here

unless this is a project and you want to compete with these guys, or have other restrictions

i figure a days work compared to offshelve solution good odds

stevenM
"no such interface supported"

therefore these statement generally means that accessing documents from http to ftp is not supported by browsers although http can view the page but is on a protected mode (i.e. readonly).

for creating javascript-based HTML editor, you will find this link very useful,

http://www.javascript-page.com/easyhtml/
I've discovered a way to get the contents of a file from a web server using javascript.  Here is what my new logon function looks like.

function logon(user,pw,server) {
  // the user and pw variables are not needed
  // because this uses HTTP instead of FTP,
  // the server variable can contain a complete URL.
  var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  xmlHttp.open("GET", server, false);
  xmlHttp.send();
  bottomframe.document.body.innerHTML=xmlHttp.responseText;
 return;
}
is the source file you are altering under your control??? ie can it always be xml ??
This question has been abandoned. I will make a recommendation to the moderators on its resolution in a week or so. I appreciate any comments that would help me to make a recommendation.
 
In the absence of responses, I may recommend DELETE unless it is clear to me that it has value as a PAQ. Silence = you don't care
 
ahosang
ahosang:

I never got any help with this.  Make whatever recommendation you think best.

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
ahosang
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of SpideyMod
SpideyMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial