Jay,

Before finding jQuery,  I had a need with my frame based applet where
one frame updated another.  I could not do so with IE  Worked find
under FF.   To resolve it, I went a frame reload approach.

Inspired by your message, I played with jQuery now to do this. I was
able to do it very easy with FF.  I thought it was pretty cool
However, under IE, this did not work.

Researching the issue, there are differences in accessing the Frame
document. I was able to access the frame document but IE still did not
allow writing to another frame.

Researching further I found an interesting Security Focus article:

http://www.securityfocus.com/archive/1/439032/100/0/threaded

This appears to be a IE security restriction by design. In addition,
according to the article FF allowing this opens up security holes:

   "Firefox differentiates based on how you reference that object and
thus
   allows you to overwrite native DOM methods on a thirdparty domain,
   broadening the potential attack scope by allowing you to interfere
with
   the operations of existing script code inside that thirdparty
document."

Maybe this is old news with IE and you are allowed to update other
frames.  But I couldn't get that to work.

Here is the function I use to get the frame document;

function getFrameDocument(aID){
  var rv = null;
  // if contentDocument exists, W3C compliant (Mozilla)
  if (parent.document.getElementById(aID).contentDocument){
   rv = parent.document.getElementById(aID).contentDocument;
  } else {
   // IE
   rv = parent.window.frames[aID].document;
  }
  return rv;
}

__
HLS

On Aug 20, 2:49 pm, Jay W <[EMAIL PROTECTED]> wrote:
> This method works fine for a single frame document.
> If you dynamically create a DOM element on the top frame and trying to
> move this element in IE, an error will be thrown.  See this 
> thread:http://groups.google.com/group/jquery-en/browse_thread/thread/e762d9b...
>
> According to Jeff, I can use
> var doc = $('#testframe')[0].contentWindow.document;  $
> (doc.body).append('<span>test</span>');
> to achieve using top's jQuery create element for all child frames.
>
> However, this method does not has the flexibility to get the new
> element easily.  The methods suggested so far will not work in IE.
>
> Any other suggestion?  Thanks. I appreciate all the responses.
>
> On Aug 20, 12:21 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote:
>
> > You could do it like this, perhaps:
>
> > var $testDiv = $("<div class='testDiv'></div>").appendTo
> > (window.document.body);
>
> > Is that what you're looking for?
>
> > --Karl
> > _________________
> > Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> > On Aug 20, 2007, at 11:47 AM, Jay W wrote:
>
> > > With the help from a few jQuery'ers, the only way to dynamically
> > > create and append element using jQuery for multiframe application is
>
> > > $(window.document.body).append("<div class='testDiv'></div>");
>
> > > This jQuery statement returns window.document.body object.
>
> > > There will be quite a few elements created this way in a same
> > > document, it will be confusing to use array index to retrieve the
> > > newly created element. So the question is: if I want to get that newly
> > > created object directly, what's the correct way to do it?
>
> > > Thanks.- Hide quoted text -
>
> > - Show quoted text -

Reply via email to