BUG: Frame SRC Property Not Updated when Navigate Method Invoked
ID: Q206652
|
The information in this article applies to:
-
Microsoft Internet Explorer (Programming) versions 4.0, 4.01, 4.01 SP1, 4.01 SP2, 5.0
SYMPTOMS
The SRC property on a frame element in an HTML window does not appear to change as that frame is navigated to other pages, unless it is changed directly from script.
RESOLUTION
To accurately determine the current URL of a document inside a frame, script code should use the window.location.href property of that frame's window object. Cross-frame scripting rules apply.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed
at the beginning of this article.
MORE INFORMATION
Steps to Reproduce Behavior
Use the following test files:
FRAMESRC.HTML
<HTML><HEAD><TITLE>Frame SRC Problem Replicator</TITLE>
<FRAMESET COLS="50%,*">
<FRAME ID="Blank" SRC="about:blank" SCROLLING=NO NORESIZE>
<FRAME ID="Doc" SRC="DocOne.html" SCROLLING=NO NORESIZE>
</FRAMESET>
</HEAD></HTML>
DOCONE.HTML
<HTML><BODY>
Doc One<P>
<INPUT TYPE="BUTTON" NAME=btnSrc VALUE="Show SRC"><P>
<INPUT TYPE="BUTTON" NAME=btnNav VALUE="Navigate to DocTwo"><P>
<A HREF="DocTwo.html">Show Doc Two</A>
<SCRIPT LANGUAGE="VBScript">
Sub btnSrc_onClick()
msgBox parent.document.all("Doc").src
End Sub
Sub btnNav_onClick()
window.navigate "DocTwo.html"
End Sub
</SCRIPT>
</BODY></HTML>
DOCTWO.HTML
<HTML><BODY>
DocTwo<P>
<INPUT TYPE="BUTTON" NAME=btnSrc VALUE="Show Src"><P>
<INPUT TYPE="BUTTON" NAME=btnNewSrc VALUE="Set SRC to DocThree">
<SCRIPT LANGUAGE="VBScript">
Sub btnSrc_onClick()
msgBox parent.document.all("Doc").src
End Sub
Sub btnNewSrc_onClick()
parent.document.all("Doc").src = "DocThree.html"
End Sub
</SCRIPT>
</BODY></HTML>
DOCTHREE.HTML
<HTML><BODY>
DocThree<P>
<INPUT TYPE="BUTTON" NAME=btnSrc VALUE="Show src">
<SCRIPT LANGUAGE="VBScript">
Sub btnSrc_onClick()
msgBox parent.document.all("Doc").src
End Sub
</SCRIPT>
</BODY></HTML>
The example frameset allows navigation through a series of three pages in the right-hand frame. In any page, the current value of the SRC property on the frame element can be viewed by clicking the Show SRC button.
When navigating between pages using any of the following methods, the SRC property is not updated to reflect the location of the new document in the right-hand frame:
- Hyperlinking via an anchor tag inside the frame
- Scripting a navigation using window.navigate
- Scripting a navigation using location.href
- Using the Back and Forward buttons
Changing the SRC property of the frame element directly--as in DOCTWO.HTML in the example--is the only way to update the frame element's SRC property correctly during a navigation.
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Jason Strayer, Microsoft Corporation
Additional query words:
Keywords : kbDHTML kbIE400bug kbIE401bug kbIE401sp1bug kbIE401sp2bug kbGrpInet kbIE500bug
Version : WINDOWS:4.0,4.01,4.01 SP1,4.01 SP2,5.0
Platform : WINDOWS
Issue type : kbbug