CWebView::Reset Method  
 
BOOL Reset();

The Reset method resets the embedded runtime control.

Parameters

None.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

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.

If the current document was cached by a previous call to SaveDocumentToMemory, this method will explicitly release the memory allocated for the document.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtmv12.lib

See Also