Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

WebBrowser.NavigateToString Method

Displays the specified HTML content.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)
'Declaration
Public Sub NavigateToString ( _
	text As String _
)

Parameters

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 Sub Button_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
    WB1.NavigateToString("<html><head></head><body>Silverlight Developer Site" & _
        "<iframe src=""http://www.silverlight.net"" WIDTH=300 HEIGHT=200>" & _
            "</iframe></body></html>")
End Sub



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


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. All rights reserved.