interface ICoreWebView2ExperimentalSettings
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 ICoreWebView2ExperimentalSettings
: public IUnknown
The ICoreWebView2Settings Experimental interface to manage the User Agent.
Summary
Members | Descriptions |
---|---|
get_UserAgent | UserAgent . |
put_UserAgent | Sets the UserAgent property. |
Applies to
Product | Introduced |
---|---|
WebView2 Win32 | N/A |
WebView2 Win32 Prerelease | 1.0.790 |
Members
get_UserAgent
UserAgent
.
public HRESULT get_UserAgent(LPWSTR * userAgent)
Returns the User Agent. The default value is the default User Agent of the Edge browser.
if (m_settings2)
{
static const PCWSTR url_compare_example = L"fourthcoffee.com";
wil::unique_bstr domain = GetDomainOfUri(uri.get());
const wchar_t* domains = domain.get();
if (wcscmp(url_compare_example, domains) == 0)
{
SetUserAgent(L"example_navigation_ua");
}
}
put_UserAgent
Sets the UserAgent
property.
public HRESULT put_UserAgent(LPCWSTR userAgent)
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.