Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.
interface IWebView2Settings2
: public IWebView2Settings
Defines properties that enable, disable, or modify WebView features.
Summary
Members | Descriptions |
---|---|
get_AreDefaultContextMenusEnabled | The AreDefaultContextMenusEnabled property is used to prevent default context menus from being shown to user in webview. |
put_AreDefaultContextMenusEnabled | Set the AreDefaultContextMenusEnabled property. |
Setting changes made after NavigationStarting event will not apply until the next top level navigation.
Members
get_AreDefaultContextMenusEnabled
The AreDefaultContextMenusEnabled property is used to prevent default context menus from being shown to user in webview.
public HRESULT get_AreDefaultContextMenusEnabled(BOOL * enabled)
Defaults to TRUE.
BOOL allowContextMenus;
CHECK_FAILURE(m_settings->get_AreDefaultContextMenusEnabled(
&allowContextMenus));
if (allowContextMenus) {
CHECK_FAILURE(m_settings->put_AreDefaultContextMenusEnabled(FALSE));
MessageBox(nullptr,
L"Context menus will be disabled after the next navigation.",
L"Settings change", MB_OK);
}
else {
CHECK_FAILURE(m_settings->put_AreDefaultContextMenusEnabled(TRUE));
MessageBox(nullptr,
L"Context menus will be enabled after the next navigation.",
L"Settings change", MB_OK);
}
put_AreDefaultContextMenusEnabled
Set the AreDefaultContextMenusEnabled property.
public HRESULT put_AreDefaultContextMenusEnabled(BOOL enabled)