Learn libcef--to remove cookies from your browser

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.