Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Set Cookie

dilfich
Posts: 368
Joined: Thu Nov 30, 2017 1:17 am

Re: Set Cookie

Post by dilfich »

Found a reason not to work if created in Temp content.

Code: Select all

TempContext := TCefRequestContextRef.New('', 'ru-RU,ru;en-US,en', False, False, False, False);
Chrom.CreateBrowser(nil, '', TempContext);
It should work or am I doing it wrong?
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Set Cookie

Post by salvadordf »

The "aAcceptLanguageList" parameter needs to be a "comma delimited ordered list of language codes without any whitespace" according to the CEF3 code comments. In this case, 'ru-RU,ru,en-US,en'.

The rest of the values are the right values to create a browser in OSR mode using "in-memory" cache.
dilfich
Posts: 368
Joined: Thu Nov 30, 2017 1:17 am

Re: Set Cookie

Post by dilfich »

Sorry for my French) :roll:
There are no problems with "aAcceptLanguageList" now.
I wrote that if you set your context CreateBrowser(nil, '', TempContext); the installation of cookies TempManager.SetCookie( does not work.

Works.

Code: Select all

Chrom.CreateBrowser(nil, '');

 if TempManager.SetCookie('https://google.com',
                                 'DSA',
                                 '77777777777777',
                                 'google.com',
                                 '/',
                                 True,
                                 True,
                                 False,
                                 now,
                                 now,
                                 now,
                                 nil) then 
Not working.

Code: Select all

TempContext := TCefRequestContextRef.New('', 'ru-RU,ru;en-US,en', False, False, False, False);
Chrom.CreateBrowser(nil, '', TempContext);

 if TempManager.SetCookie('https://google.com',
                                 'DSA',
                                 '77777777777777',
                                 'google.com',
                                 '/',
                                 True,
                                 True,
                                 False,
                                 now,
                                 now,
                                 now,
                                 nil) then 
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Set Cookie

Post by salvadordf »

If you use a new request context for a browser then use this code to get its cookie manager :

Code: Select all

TempManager := TempContext.GetDefaultCookieManager(nil);
dilfich
Posts: 368
Joined: Thu Nov 30, 2017 1:17 am

Re: Set Cookie

Post by dilfich »

Thank!
Post Reply