ICoreWebView2Settings2

Undocumented in source.
version(Windows && inline_webview2_bindings && all)
interface ICoreWebView2Settings2 : ICoreWebView2Settings {
static const
GUID iid;
}

Members

Functions

get_UserAgent
HRESULT get_UserAgent(LPWSTR* userAgent)

Returns the User Agent. The default value is the default User Agent of the Microsoft Edge browser.

put_UserAgent
HRESULT put_UserAgent(LPCWSTR userAgent)

Sets the UserAgent property. This property may be overridden if the User-Agent header is set in a request. If the parameter is empty the User Agent will not be updated and the current User Agent will remain. Returns HRESULT_FROM_WIN32(ERROR_INVALID_STATE) if the owning WebView is closed.

Inherited Members

From ICoreWebView2Settings

get_IsScriptEnabled
HRESULT get_IsScriptEnabled(BOOL* isScriptEnabled)

Controls if running JavaScript is enabled in all future navigations in the WebView. This only affects scripts in the document. Scripts injected with ExecuteScript runs even if script is disabled. The default value is TRUE.

put_IsScriptEnabled
HRESULT put_IsScriptEnabled(BOOL isScriptEnabled)

Sets the IsScriptEnabled property.

get_IsWebMessageEnabled
HRESULT get_IsWebMessageEnabled(BOOL* isWebMessageEnabled)

The IsWebMessageEnabled property is used when loading a new HTML document. If set to TRUE, communication from the host to the top-level HTML document of the WebView is allowed using PostWebMessageAsJson, PostWebMessageAsString, and message event of window.chrome.webview. For more information, navigate to PostWebMessageAsJson. Communication from the top-level HTML document of the WebView to the host is allowed using the postMessage function of window.chrome.webview and add_WebMessageReceived method. For more information, navigate to add_WebMessageReceived. If set to false, then communication is disallowed. PostWebMessageAsJson and PostWebMessageAsString fails with E_ACCESSDENIED and window.chrome.webview.postMessage fails by throwing an instance of an Error object. The default value is TRUE.

put_IsWebMessageEnabled
HRESULT put_IsWebMessageEnabled(BOOL isWebMessageEnabled)

Sets the IsWebMessageEnabled property.

get_AreDefaultScriptDialogsEnabled
HRESULT get_AreDefaultScriptDialogsEnabled(BOOL* areDefaultScriptDialogsEnabled)

AreDefaultScriptDialogsEnabled is used when loading a new HTML document. If set to FALSE, WebView2 does not render the default JavaScript dialog box (Specifically those displayed by the JavaScript alert, confirm, prompt functions and beforeunload event). Instead, if an event handler is set using add_ScriptDialogOpening, WebView sends an event that contains all of the information for the dialog and allow the host app to show a custom UI. The default value is TRUE.

put_AreDefaultScriptDialogsEnabled
HRESULT put_AreDefaultScriptDialogsEnabled(BOOL areDefaultScriptDialogsEnabled)

Sets the AreDefaultScriptDialogsEnabled property.

get_IsStatusBarEnabled
HRESULT get_IsStatusBarEnabled(BOOL* isStatusBarEnabled)

IsStatusBarEnabled controls whether the status bar is displayed. The status bar is usually displayed in the lower left of the WebView and shows things such as the URI of a link when the user hovers over it and other information. The default value is TRUE. The status bar UI can be altered by web content and should not be considered secure.

put_IsStatusBarEnabled
HRESULT put_IsStatusBarEnabled(BOOL isStatusBarEnabled)

Sets the IsStatusBarEnabled property.

get_AreDevToolsEnabled
HRESULT get_AreDevToolsEnabled(BOOL* areDevToolsEnabled)

AreDevToolsEnabled controls whether the user is able to use the context menu or keyboard shortcuts to open the DevTools window. The default value is TRUE.

put_AreDevToolsEnabled
HRESULT put_AreDevToolsEnabled(BOOL areDevToolsEnabled)

Sets the AreDevToolsEnabled property.

get_AreDefaultContextMenusEnabled
HRESULT get_AreDefaultContextMenusEnabled(BOOL* enabled)

The AreDefaultContextMenusEnabled property is used to prevent default context menus from being shown to user in WebView. The default value is TRUE.

put_AreDefaultContextMenusEnabled
HRESULT put_AreDefaultContextMenusEnabled(BOOL enabled)

Sets the AreDefaultContextMenusEnabled property.

get_AreHostObjectsAllowed
HRESULT get_AreHostObjectsAllowed(BOOL* allowed)

The AreHostObjectsAllowed property is used to control whether host objects are accessible from the page in WebView. The default value is TRUE.

put_AreHostObjectsAllowed
HRESULT put_AreHostObjectsAllowed(BOOL allowed)

Sets the AreHostObjectsAllowed property.

get_IsZoomControlEnabled
HRESULT get_IsZoomControlEnabled(BOOL* enabled)

The IsZoomControlEnabled property is used to prevent the user from impacting the zoom of the WebView. When disabled, the user is not able to zoom using Ctrl++, Ctrl+-, or Ctrl+mouse wheel, but the zoom is set using ZoomFactor API. The default value is TRUE.

put_IsZoomControlEnabled
HRESULT put_IsZoomControlEnabled(BOOL enabled)

Sets the IsZoomControlEnabled property.

get_IsBuiltInErrorPageEnabled
HRESULT get_IsBuiltInErrorPageEnabled(BOOL* enabled)

The IsBuiltInErrorPageEnabled property is used to disable built in error page for navigation failure and render process failure. When disabled, a blank page is displayed when the related error happens. The default value is TRUE.

put_IsBuiltInErrorPageEnabled
HRESULT put_IsBuiltInErrorPageEnabled(BOOL enabled)

Sets the IsBuiltInErrorPageEnabled property.

Meta