ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Remote Scripting with IFRAME
Subject:   RE: IE5.0 error - a solution
Date:   2002-07-08 09:25:55
From:   sanjev
Thanks for the Article Mr. Costello.


This is mostly a reply to Geeet's error issue, however. Some time ago when writing code to do something along the lines of what you are doing I encountered the same problem. You will recieve "Class doesn't support Automation: on the:
IFrameObj = document.frames['RSIFrame'];
OR (if you avoid that)
you will find that:
IFrameObj.document === document
(Clearly you do not wish to write to that!)


One solution is to dowload the iframe in the main page (form the server) and then manipulate it (which works on IE, but not NS6, your your code gets ugly) but that is undesirable (but I have been doing it)


A better solution is, instead of:
var tempIFrame=document.createElement('iframe');
...
IFrameObj = document.body.appendChild(tempIFrame);


try:
var dv = document.createElement ('div');
dv = document.body.appendChild (dv);
dv.innerHTML = '<iframe id="RSIFrame"></iframe>'
var iframe = document.getElementById("RSIFrame")


then the document.frames["RSIFrame"] will succeed along with all code that follows. Clearly that is ONLY they way to do it on IE5.0, all other browsers can user the *much* cleaner code provided in this artice.