Export (0) Print
Expand All

WebBrowser.Navigate Method

Loads the HTML content at the specified URI.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

public void Navigate(
	Uri source
)

Parameters

source
Type: System.Uri
The URI of the HTML content to load.

The specified URI can be fully qualified or be a relative URI. When you set use a relative URI you should use the following convention:

  • "/Page1.html" is an application level resource that gets resolved to the base URI of the application (XAP file). This means the relative URI must resolve to the same site of origin as the application.

You cannot specify a URL to an embedded or local resource.

The following example shows a WebBrowser with its Source property set to an HTML page. In a button event handler, the WebBrowser source is changed to a different HTML page by calling the Navigate(Uri) method. The host Silverlight application must be running outside the browser or in an in-browser trusted application for this example to function correctly.



private void Button1_Click(object sender, RoutedEventArgs e)
{
    WB1.Navigate(new Uri("http://localhost/HTMLPage2.htm"));

}



<TextBlock Text="WebBrowser Control" />
<WebBrowser Source="http://localhost/HTMLPage1.html" Height="160" Width="160" x:Name="WB1"/>
<Button Width="200" x:Name="Button1" Content="Click for HTML content" Click="Button1_Click"   />


Silverlight

Supported in: 5, 4

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft