Re: XP SP2 cross-iframe scripting
From: Dave Methvin (news0110_at_methvin.com)
Date: 09/17/04
- Next message: Lasse Reichstein Nielsen: "Re: js and Safari"
- Previous message: Lasse Reichstein Nielsen: "Re: Escaping escape characters in JScript"
- In reply to: Bill Thorne: "RE: XP SP2 cross-iframe scripting"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Sep 2004 13:21:09 -0400
Here's something that may affect it as well. In XP SP2 the scripting engine
will invalidate any objects within an element that you reprocess by a
document.write, using EditMode, or by changing .src attributes. So, trying
to use myframe after setting theFrame.src would cause an error unless you
re-assigned the object:
var myframe = theFrame.document;
theFrame.src = "whatever.htm"
// myframe is no longer valid
var myframe = theFrame.document;
// myframe now references the new object
http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/sp2brows.mspx#EFAA
Bill Thorne wrote:
> I have found a work-around which is stupid but works, wanted to post
> so others can benefit.
>
> Instead of:
>
> theFrame.src=newURL;
>
> Do:
>
> theFrame.document.open()
> theFrame.document.write('<html><body leftmargin=0 topmargin=0
> scroll="no"><iframe frameborder=no scrolling=no marginheight=0
> marginwidth=0 src="'+newURL+'" width="100%"
> height="100%"></body></html>'); theFrame.document.close();
>
> This works in terms of retaining the ability to script into the
> contained document, just have to adjust DOM reference from
> theFrame.document to theFrame.document.frames[0].document...
>
> This looks to be a BUG in IE6, as the domains of all the objects here
> are identical so there is no reason to remove the ability to script
> into a document that is inside an IFRAME that has had it's src
> property modified.
>
> This MUST be breaking a lot of sites!
>
>
>
> "Bill Thorne" wrote:
>
>> I have an SP2 problem with an iframe environment where by setting
>> the SRC property of an IFRAME I lose scripting access to the
>> document within the IFRAME. All objects, IFRAMES etc. are served
>> from the same domain, same server, same folder.
>>
>> The initial property of the SRC tag is to a dummy, empty.html
>> document and when this is active, the document.domain property can
>> be read and I verify that it has the same domain as the parent page
>> and other IFRAME objects in the page.
>>
>> As soon as the SRC property is changed to load a different document
>> in the IFRAME, all scripting access INTO the document from the
>> parent frame becomes blocked. ODDLY, scripting access from INSIDE
>> the new IFRAME to the parent is NOT, and the document's script can
>> request other IFRAMES to popup and work, etc.
>>
>> I have tried hard-coding fully qualified URL entries in the SRC to
>> try to "help" the IE security context/domain recognition but nothing
>> helps. Using the document.location.replace(newURL) method is even
>> worse, as it only works once, then since the scripting is lost, can
>> no longer load a new doc in the IFRAME (changing src attribute
>> continues to be OK, just can't access anything inside the IFRAME).
>>
>> Get a "Permission Denied" exception on trying to even read the loaded
>> document's document.domain property.
>>
>> I would appreciate any tips on how to change the document inside an
>> IFRAME without hitting this bug. I suppose I will try hosting the
>> IFRAME inside a SPAN and then reset the innerHTML of the SPAN so
>> that the SRC of the IFRAME can always be hardcoded...which I know
>> works from some other IFRAMES on the same page.
>> --
>> Bill Thorne
>> Host Integration Tools Author for .NET
- Next message: Lasse Reichstein Nielsen: "Re: js and Safari"
- Previous message: Lasse Reichstein Nielsen: "Re: Escaping escape characters in JScript"
- In reply to: Bill Thorne: "RE: XP SP2 cross-iframe scripting"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|