I can't make a webpage cache (use VisitUrlCookies Func).

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

I can't make a webpage cache (use VisitUrlCookies Func).

Postby mung » Tue Aug 29, 2017 4:41 am

Hi :)
(version win7, CEF 3.3071.1634, c++)
(Sorry, my English is poor. :()

I tried to make cache (use CefCookieManager::VisitUrlcookies() Func) for precaching a webpage.

However, only an empty folder is generated automatically without any cached files.

I tried the following codes right after executing "CefInitialize();" function.

Code: Select all
CefRefPtr<CefCookieManager> manager = CefCookieManager::CreateManager(CefString("./cookies"), false, NULL);


And I tried following codes for making a webpage cache.

Code: Select all
CefCookie cookie;
CefString(&cookie.name).FromASCII("my_cookie");
CefString(&cookie.value).FromASCII("my_value");

CookieVector cookies;
cookies.push_back(cookie);
CefString strURL;

bool bResult = false;
CefRefPtr<CefWaitableEvent> event = CefWaitableEvent::CreateWaitableEvent(true, false);
scoped_refptr<SetCookieCallback> pCallback = new SetCookieCallback(true, event);
scoped_refptr<CookieVisitor> pVisitor = new CookieVisitor(&cookies, false, event);

strURL.FromASCII("http://someurl"); // Actually private a webpage.
bResult = manager->SetCookie(strURL, cookie, pCallback);
bResult = manager->VisitUrlCookies(strURL, false, pVisitor);
event->Wait();
cookies.clear();

// I tried
//CefRefPtr<CefWaitableEvent> evnet_all = CefWaitableEvent::CreateWaitableEvent(true, false);
//scoped_refptr<CookieVisitor> pVisitor_all = new CookieVisitor(&cookies, false, event_all);
//vResult = manager->VisitAllCookies(pVisitor_all);

// I tried
//CefRefPtr<CefWaitableEvent> eventFlush = CefWaitableEvent::CreateWaitableEvent(true, false);
//scoped_refptr<CookieCompletionCallback> pCallbackFlush = new CookieCompletionCallback(eventFlush);
//manager->FlushStore(pCallbackFlush);
//eventFlush->Wait();




How can I make cache files for webpage correctly ?

Is there any errors in my codes?

I want to make cache files before opening a webpage.

Please let me know if there is unclarity in my post.

Thank you very much :)
mung
Mentor
 
Posts: 58
Joined: Wed Jan 04, 2017 12:20 am

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 50 guests