Long ago, we discussed the setting of a cookie for you CEF.
Now, add a bit if you delete a cookie from your browser.
Review set Cookies:
STD:: wstring Username_key = L"username"; STD:: wstring username_value = L"Xidada"; STD:: wstring domain = L"Blog.csdn.net"Cefrefptr<cefcookiemanager> manager = Cefcookiemanager::getglobalmanager ();Cefcookie Cookies;Cefstring (&cookie. Name). Fromwstring(Username_key. C_str ());Cefstring (&cookie. Value). Fromwstring(Username_value. C_str ());Cefstring (&cookie. Domain). Fromwstring(Domain. C_str ());Cefstring (&cookie. Path). Fromascii("/");Cookies. has_expires = False;Domain = L"https://"+ Domain;Cefposttask (Tid_io, Newcefrunnablemethod (manager. Get(), &cefcookiemanager::setcookie,cefstring (domain. C_str ()), cookies));Create browser Cefbrowserhost::createbrowser (info, g_web_browser_client. Get(), Domain. C_str (), browsersettings, NULL);
Start deleting a cookie now:
deletecookies
Look at the function description:
//Delete AllCookies thatMatchThe specified parameters.If both|url| and//Values|cookie_name| isSpecified AllHost and DomainCookies Matching//bothwould be deleted.If only|url| isSpecified AllHost Cookies (but not//DomainCookies) Irrespective ofPath would be deleted.If|url| isEmpty AllCookies for AllHosts andDomains'll be deleted. Returnsfalse ifA non-//empty invalid URL isSpecifiedor ifCookies cannot be accessed. This//method must is called onThe IO thread. /*--CEF (optional_param=url,optional_param=cookie_name)--*/virtual bool deletecookies (const cefstring& URL, Const cefstring& Cookie_name) =0;
Application:
CefPostTask(TID_IO, NewCefRunnableMethod(manager.get(), &CefCookieManager::DeleteCookies, CefString(domain.c_str()), CefString("username")));
The above code removes the cookie set for "blog.csdn.net":
Username = Xidada
Learn libcef--to remove cookies from your browser