Microsoft KB Archive/274091

= BUG: Dynamically Created WFC Frames Lose Content During Refresh =

Article ID: 274091

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Visual J++ 6.0 Standard Edition
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q274091



SYMPTOMS
When you host a WebBrowser control within an applet and display a frameset, the content of a frame that is dynamically created by the Windows Foundation Classes for Java (WFC) may be lost if an anchor on the frame is targeted by a hyperlink that is located in a second frame.

This only occurs when you use WFC and Internet Explorer 5.5.



CAUSE
By design, Internet Explorer 5.5 uses only one WebBrowser control (Shdocvw.dll) to handle the frameset; as a result, dynamically created WFC content is lost during refresh.

In Internet Explorer 5.01 and earlier, a frameset uses multiple instances of the WebBrowser control. For example, a frameset that contains two frames uses three instances: one instance for each frame, and one for the frameset itself. In Internet Explorer 5.5, the same frameset uses only one instance of the WebBrowser control for everything.



RESOLUTION
To work around this problem, do not allow the targeted frame to refresh when you bring its targeted anchor into display. To do this, specify the inline script method, scrollIntoView, instead of the # tag to identify the anchor on the targeted frame. (See the &quot;More Information&quot; section for sample code.) The scrollIntoView method suppresses the need to refresh the targeted frame and forces the frame to scroll only to the identified anchor location.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
NOTE: This problem only occurs when you run Internet Explorer 5.5 and dynamically create the frames with WFC. Straight HTML does not reproduce the problem.

 Take a frameset that has two frames, Frame1 and Frame2. Frame2 contains an anchor, Anchor1, which is targeted by Frame1.  The following Java code creates a hyperlink on Frame1 that targets Anchor1: DhHyperlink hlLink1 = new DhHyperlink (                                       new String (&quot;Frame2&quot; + &quot;#&quot; + &quot;Anchor1&quot; ),                                       &quot;Anchor1&quot;); This code uses the # tag, which forces Frame2 to refresh when it moves to the location of Anchor1. 

Workaround Sample Code
To work around this, modify the above code as follows: DhHyperlink hlLink1 = new DhHyperlink (                                       new String (&quot;javascript:top.&quot; + &quot;Frame2&quot; + &quot;.Anchor1.scrollIntoView; void(0);&quot;),                                       &quot;Anchor1&quot;); This code uses the scrollIntoView method, which does not require Frame2 to refresh but instead scrolls to the location of Anchor1.

