WebBrowser.NavigateToString Method

Displays the specified HTML content.

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

public void NavigateToString(
	string text


Type: System.String
The HTML content to display in the WebBrowser control.

The text parameter should be formatted as HTML. The text parameter can also contain JavaScript. If there are JavaScript functions contained in the HTML, you can use the InvokeScript method to call the functions from managed code. For security reasons, you should never display user-provided, and therefore untrusted, HTML using the NavigateToString method.

The following example shows how to use the NavigateToString method to display cross-domain content in an <iframe>.

private void Button_Click(object sender, RoutedEventArgs e)
    WB1.NavigateToString("<html><head></head><body>Silverlight Developer Site" +
    "<iframe src=\"http://www.silverlight.net\" WIDTH=300 HEIGHT=200>" + 

    <Button Width="200" Content="Click for Silverlight.net" Click="Button_Click"  />
    <WebBrowser Height="270" Width="400" x:Name="WB1" />


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