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 | |
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.
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.
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈