Observação
O acesso a essa página exige autorização. Você pode tentar entrar ou alterar diretórios.
O acesso a essa página exige autorização. Você pode tentar alterar os diretórios.
Note
This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.
Note
This an experimental API that is shipped with our prerelease SDK. See WebView2 release notes.
interface ICoreWebView2ExperimentalProfile17
: public IUnknown
This is an interface to control Enhanced Security Mode (ESM) state.
Summary
| Members | Descriptions |
|---|---|
| get_EnhancedSecurityModeState | Gets the EnhancedSecurityModeState property. |
| put_EnhancedSecurityModeState | The EnhancedSecurityModeState property allows you to control whether Enhanced Security Mode is enabled or disabled for WebView2 instances associated with a profile. |
Applies to
| Product | Introduced |
|---|---|
| WebView2 Win32 | N/A |
| WebView2 Win32 Prerelease | 1.0.4015 |
Members
get_EnhancedSecurityModeState
Gets the EnhancedSecurityModeState property.
public HRESULT get_EnhancedSecurityModeState(COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE * value)
put_EnhancedSecurityModeState
The EnhancedSecurityModeState property allows you to control whether Enhanced Security Mode is enabled or disabled for WebView2 instances associated with a profile.
public HRESULT put_EnhancedSecurityModeState(COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE value)
This applies to all WebViews sharing the same profile. The configuration is not persisted to the user data folder. The property is reset when the profile is recreated.
The default value is COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE_DISABLED.
When set to Disabled, Enhanced Security Mode is disabled. When set to Enabled, Enhanced Security Mode is enabled.
See COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE for descriptions of states.
Changes apply immediately to new navigation. Existing pages require a reload for the change to take effect.
void SettingsComponent::SetEnhancedSecurityModeState(
COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE value)
{
wil::com_ptr<ICoreWebView2_13> webView2_13;
webView2_13 = m_webView.try_query<ICoreWebView2_13>();
if (webView2_13)
{
wil::com_ptr<ICoreWebView2Profile> profile;
CHECK_FAILURE(webView2_13->get_Profile(&profile));
auto experimentalProfile17 = profile.try_query<ICoreWebView2ExperimentalProfile17>();
if (experimentalProfile17)
{
CHECK_FAILURE(experimentalProfile17->put_EnhancedSecurityModeState(value));
const wchar_t* stateText = L"Disabled";
if (value == COREWEBVIEW2_ENHANCED_SECURITY_MODE_STATE_ENABLED)
{
stateText = L"Enabled";
}
MessageBox(
nullptr,
(std::wstring(L"Enhanced Security Mode state is set to ") + stateText).c_str(),
L"Enhanced Security Mode State", MB_OK);
}
}
}