BUG: Dynamically Created WFC Frames Lose Content During Refresh (274091)



The information in this article applies to:

  • Microsoft Visual J++ 6.0
  • Microsoft Internet Explorer (Programming) 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 "More Information" 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.

MORE INFORMATION

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.

  1. Take a frameset that has two frames, Frame1 and Frame2. Frame2 contains an anchor, Anchor1, which is targeted by Frame1.
  2. The following Java code creates a hyperlink on Frame1 that targets Anchor1:
    DhHyperlink hlLink1 = new DhHyperlink (
                                            new String ("Frame2" + 
                                                        "#" + 
                                                        "Anchor1" ),
                                            "Anchor1"); 
    						
    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 ("javascript:top." + 
                                                    "Frame2" + 
                                                    ".Anchor1.scrollIntoView(); void(0);"),
                                        "Anchor1"); 
				
This code uses the scrollIntoView method, which does not require Frame2 to refresh but instead scrolls to the location of Anchor1.

REFERENCES

For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Modification Type:MajorLast Reviewed:6/14/2006
Keywords:kbBug kbnofix kbWFC KB274091