interface ICoreWebView2ExperimentalCookieList
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 ICoreWebView2ExperimentalCookieList
: public IUnknown
A list of cookie objects.
Summary
| Members | Descriptions |
|---|---|
| get_Count | The number of cookies contained in the ICoreWebView2ExperimentalCookieList. |
| GetValueAtIndex | Gets the cookie object at the given index. |
See ICoreWebView2ExperimentalCookie.
if (m_cookieManager)
{
CHECK_FAILURE(m_cookieManager->GetCookies(
uri.c_str(),
Callback<ICoreWebView2ExperimentalGetCookiesCompletedHandler>(
[this, uri](HRESULT error_code, ICoreWebView2ExperimentalCookieList* list) -> HRESULT {
CHECK_FAILURE(error_code);
std::wstring result;
UINT cookie_list_size;
CHECK_FAILURE(list->get_Count(&cookie_list_size));
if (cookie_list_size == 0)
{
result += L"No cookies found.";
}
else
{
result += std::to_wstring(cookie_list_size) + L" cookie(s) found";
if (!uri.empty())
{
result += L" on " + uri;
}
result += L"\n\n[";
for (int i = 0; i < cookie_list_size; ++i)
{
wil::com_ptr<ICoreWebView2ExperimentalCookie> cookie;
CHECK_FAILURE(list->GetValueAtIndex(i, &cookie));
if (cookie.get())
{
result += CookieToString(cookie.get());
if (i != cookie_list_size - 1)
{
result += L",\n";
}
}
}
result += L"]";
}
MessageBox(nullptr, result.c_str(), L"GetCookies Result", MB_OK);
return S_OK;
})
.Get()));
}
Members
get_Count
The number of cookies contained in the ICoreWebView2ExperimentalCookieList.
public HRESULT get_Count(UINT * count)
GetValueAtIndex
Gets the cookie object at the given index.
public HRESULT GetValueAtIndex(UINT index, ICoreWebView2ExperimentalCookie ** cookie)