Disable cookies entirely

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.

Disable cookies entirely

Postby callum » Thu Jan 18, 2018 12:17 pm

Using a recent version of CEF in Windows (3.3239.1723) and want to disable cookies entirely based on user preference.

If user doesn't want to accept any cookies, I call CefCookieManager::SetStoragePath("", false, nullptr); and as expected, the cookies folder or corresponding database is not created - I think they're just created in memory?

However, pages like this: https://www.whatismybrowser.com/detect/ ... es-enabled still report cookies as enabled and our users will certainly try pages like that and get sad if they appear to be on; especially as they report NO when turned off in desktop Chrome.

Is there a setting I can change so that page reports "NO" when they're turned off in my app.
callum
Expert
 
Posts: 323
Joined: Mon Feb 23, 2015 6:19 pm

Re: Disable cookies entirely

Postby HarmlessDave » Thu Jan 18, 2018 7:52 pm

If no one else offers a better solution, have you tried implementing a custom CefCookieManager where your list of supported protocols is an empty list or "null"? I have no idea whether this will work or just error out.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Disable cookies entirely

Postby callum » Thu Jan 18, 2018 9:42 pm

Interesting idea - thank you.

I did have my own CefCookieManager and reverted the code to use the global one (which works fine) - I can put that back and modify as you suggest - I'll post here with results tomorrow.

Cal.

A few minutes later...

The docs in the header for CefCookieManager::SetSupportedSchemes(...) say

// Set the schemes supported by this manager. The default schemes ("http",
// "https", "ws" and "wss") will always be supported. .....

So I don't think this will work - nice idea though.
callum
Expert
 
Posts: 323
Joined: Mon Feb 23, 2015 6:19 pm

Re: Disable cookies entirely

Postby HarmlessDave » Thu Jan 18, 2018 10:50 pm

This might work, though it will take much more code: CefResourceHandler has events for both getting and setting cookies, if you return false to both then if I'm reading it correctly that will disable cookie use.

Before doing that you might wait in case there's a Chromium setting that search did not show me, or a CEF setting to do this automatically. The CefClient test menu includes a test that lists the Chromium settings, you might scroll through those.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Disable cookies entirely

Postby callum » Fri Jan 19, 2018 11:27 am

I have the latest CEFClient but I don't see that test - removed maybe or more likely, I'm looking right past it.
callum
Expert
 
Posts: 323
Joined: Mon Feb 23, 2015 6:19 pm

Re: Disable cookies entirely

Postby HarmlessDave » Fri Jan 19, 2018 12:33 pm

In 3.3202 it's (menu) > Tests > Other Tests > (page of links) > Preferences > Advanced
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Disable cookies entirely

Postby callum » Fri Jan 19, 2018 12:44 pm

I see it thanks.

Lots of interesting options in there but nothing relevant to my issue though.

I'll keep digging.
callum
Expert
 
Posts: 323
Joined: Mon Feb 23, 2015 6:19 pm

Re: Disable cookies entirely

Postby magreenblatt » Thu Feb 01, 2018 9:58 pm

magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: Disable cookies entirely

Postby callum » Thu Feb 01, 2018 10:10 pm

Great - thank you.
callum
Expert
 
Posts: 323
Joined: Mon Feb 23, 2015 6:19 pm

Re: Disable cookies entirely

Postby Janani » Fri Apr 12, 2019 3:06 am

How to turn off "Block third party cookies" settings. I see "--block-reading-third-party-cookies" CefCommandLineArgs for this, but it looks like it is obsolete now. What is the active Key to achieve this?
Janani
Newbie
 
Posts: 1
Joined: Fri Apr 12, 2019 2:38 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 49 guests