Compartilhar via


CoreWebView2.NavigateToString(String) Method

Definition

Initiates a navigation to htmlContent as source HTML of a new document.

public void NavigateToString (string htmlContent);
member this.NavigateToString : string -> unit
Public Sub NavigateToString (htmlContent As String)

Parameters

htmlContent
String

A source HTML of a new document.

Examples

webView.CoreWebView2.SetVirtualHostNameToFolderMapping(
    "appassets.example", "assets", CoreWebView2HostResourceAccessKind.DenyCors);
string htmlContent =
@"
    <head><link rel="stylesheet" href="http://appassets.example/wv2.css" /></head><body><img src="http://appassets.example/wv2.png" /><p><a href="http://appassets.example/winrt_test.txt"> Click me</a></p></body>
";
webview.NavigateToString(htmlContent);

Remarks

The htmlContent parameter may not be larger than 2 MB (2 * 1024 * 1024 bytes) in total size. The origin of the new page is about:blank.

Applies to

See also