共用方式為


WebView2.NavigateToString(String) Method

Definition

Initiates a navigation to htmlContent as source HTML of a new document. Equivalent to calling NavigateToString(String).

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

Parameters

htmlContent
String

Implements

Exceptions

Thrown if CoreWebView2 hasn't been initialized yet, or if the calling thread isn't the thread which created this object (usually the UI thread). See VerifyAccess() for more info. May also be thrown if the browser process has crashed unexpectedly and left the control in an invalid state. We are considering throwing a different type of exception for this case in the future.

Thrown if Dispose(Boolean) has already been called on the control.

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