Reset Method  
 

Resets the browser instance by clearing its state and releasing cached document data.

Syntax

object.Reset

Parameters

None.

Return Value

None.

Remarks

The Reset method clears the state of the current browser session and restores it to its default configuration. This includes discarding cached content, navigation history, and any data associated with the last document. The control is then navigated to an empty about:blank page and the zoom level is reset to its default value.

Internally, this method releases cached strings such as the most recent message, script result, and document text, clears the current HTTP status and security information, removes cached data, and clears the session history. A navigation to about:blank is performed, and the host window is invalidated to ensure that the client area is repainted. The call blocks until the navigation has completed or the operation times out.

Because this method performs a complete reset of the WebView2 control, it should be used in situations where the browser needs to be returned to a known, clean state (for example, when reinitializing a session or preparing the control for a new task). Applications that only need to refresh the current document should use Reload or Redraw instead, as they are lighter-weight operations.

This method cannot be called while a navigation is already in progress. Attempting to do so will fail with an error code indicating that the operation is in progress. As with other navigation-related functions, it must be called on the thread that owns the browser window, or the request will be marshaled back to the UI thread.

See Also

Cancel Method, Initialize Method, Uninitialize Method