locked
Frame fully loaded event RRS feed

  • Question

  • Hi,

    i want to load a web page on a frame, usually it took more than 30 seconds to load the web page and during this time the window seems to be not responding.

    To avoid the non responding nature i load the content from background thread , but still the page seems to be non responding once i set source property of frame.

    How can i avoid the non responding nature.

    Is any way to know when all the contents is loaded on the frame


    Thanks ***Share Knowledge to gain more***
    Saturday, October 15, 2011 12:21 PM

Answers

  • Hi FullPgmr,

    I think I find the root cause of your issue.

    First, please refer to the Remarks part of the following link:

    http://msdn.microsoft.com/en-us/library/system.windows.controls.frame.aspx

    Pay attention to the yellow color hightlight Caution:

    When the Frame control navigates to HTML content, the Frame control internally instantiates the native WebBrowser ActiveX control. WPF enables security features by applying feature controls to the WebBrowser ActiveX control. The feature controls that are applied differ for XBAPs and stand-alone applications. Some applications should apply additional feature controls to prevent malicious content from running. For more information, see the "WebBrowser Control and Feature Controls" section in Security (WPF) and WebBrowser Control Overviews and Tutorials.

    As above words explain, when Frame control navigates to HTML content, Frame control just instantiates the native WebBrowser, and let the WebBrowser ActiveX control to access page due to security consideration.

    In your case, haven’t your page content completed load, the LoadCompleted event has been invoked. Generally, the LoadCompleted event will invoked when the Frame complete load. But as we above talk, the Frame just instantiates the native WebBrowser, so when Frame complete create the WebBrowser, the LoadCompleted event invoked unexpected.

    So if we want to judge when page complete loading in Frame, we can use the function and event of WebBrowser to deal with it.

    For more information about WebBrowser control, please check out the following link for your reference:

    http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser(v=VS.95).aspx

    If you have any additional questions, please feel free to let me know.

    Have a nice day.

     


    Annabella Luo [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Annabella Luo Monday, October 24, 2011 6:19 AM
    Friday, October 21, 2011 2:38 AM

All replies

  • Hi FullPgmr,

    Thank you for your post.

    According to your description, I can hardly know why so much time needed for loading the web page.

    Is your page contain a large number of content? Or does your page show correct after long time loading?

    We need some additional information here to be able to determine what is going on. Could you kindly offer more details about your issue? It would be appreciated if you could offer a simple ready-to-run sample for us. You could upload it to SkyDrive space and post a link here.

    If you have any additional questions, please feel free to let me know.

    Have a nice day. 


    Annabella Luo [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, October 19, 2011 5:42 AM
  • Hi,

    My the reason for slow loading of page content is may be sometimes because of slow internet connection speed , or the webpage contains some time consuming operations to perform before loading it,..

    If we open webpage on a browser on the top of the tab we can see a message like  Connecting..... and after the page contents are available then  the  browser tab shows the title of the page.

    I want to generate the same situation here in my wpf application. Once i assign the Source property on the frame i need a message like Connecting........ and when the page contents is displayed on the frame i need the Page title on the label.

    My problem is once i assign the source property of the frame the backgroundWorker_Completed event occurs , but still the frame is in loading state. How can i avoid this suituation or i need to complete background thread once the frame shows the contents

     


    Thanks ***Share Knowledge to gain more***
    Wednesday, October 19, 2011 6:37 AM
  • Hi FullPgmr,

    Please check out the following link about LoadCompleted Event for your reference:

    http://msdn.microsoft.com/en-us/library/system.windows.controls.frame.loadcompleted.aspx

    If you have any additional questions, please feel free to let me know.

    Have a nice day.


    Annabella Luo [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, October 19, 2011 8:56 AM
  • Hi,

    Thanks for the reply

    I use the specified event   LOADCOMPLETED  like below

     

      lblApplicationStatus.Content = "Please wait....";  <br/>activeframeControl.NavigationService.Navigate(activeFrameUrl);
           activeframeControl.NavigationService.LoadCompleted += new LoadCompletedEventHandler(frame_LoadCompleted);
                
            void frame_LoadCompleted(object sender, NavigationEventArgs e)
            {
             
                    lblApplicationStatus.Content = "content loaded.....";
           
            }
    

    The result is once i got the mesaage "content loaded..." the mouse pointer  is changed to waiting state and the contents are started to draw on the frame....but still it tooks some time say 10-15 seconds to download the contents and display them on  the  frame..I think LOADCOMPLETED   event fires once the page is ready to display not after all page contents are shown on the frame.

    Is there any way to make my Aplication status message as "Please wait......"   untill all contents are displayed on the frame

     


    Thanks ***Share Knowledge to gain more***
    Thursday, October 20, 2011 7:46 AM
  • Hi FullPgmr,

    I think I find the root cause of your issue.

    First, please refer to the Remarks part of the following link:

    http://msdn.microsoft.com/en-us/library/system.windows.controls.frame.aspx

    Pay attention to the yellow color hightlight Caution:

    When the Frame control navigates to HTML content, the Frame control internally instantiates the native WebBrowser ActiveX control. WPF enables security features by applying feature controls to the WebBrowser ActiveX control. The feature controls that are applied differ for XBAPs and stand-alone applications. Some applications should apply additional feature controls to prevent malicious content from running. For more information, see the "WebBrowser Control and Feature Controls" section in Security (WPF) and WebBrowser Control Overviews and Tutorials.

    As above words explain, when Frame control navigates to HTML content, Frame control just instantiates the native WebBrowser, and let the WebBrowser ActiveX control to access page due to security consideration.

    In your case, haven’t your page content completed load, the LoadCompleted event has been invoked. Generally, the LoadCompleted event will invoked when the Frame complete load. But as we above talk, the Frame just instantiates the native WebBrowser, so when Frame complete create the WebBrowser, the LoadCompleted event invoked unexpected.

    So if we want to judge when page complete loading in Frame, we can use the function and event of WebBrowser to deal with it.

    For more information about WebBrowser control, please check out the following link for your reference:

    http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser(v=VS.95).aspx

    If you have any additional questions, please feel free to let me know.

    Have a nice day.

     


    Annabella Luo [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Annabella Luo Monday, October 24, 2011 6:19 AM
    Friday, October 21, 2011 2:38 AM
  • We are temporarily marking this as "Answer", if you have any concerns or new findings; please feel free to unmark this.

    Best regards.


    Annabella Luo [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 24, 2011 6:19 AM