Page 2 of 2

Re: Set Cookie

Posted: Wed Nov 28, 2018 1:10 pm
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?

Re: Set Cookie

Posted: Wed Nov 28, 2018 1:39 pm
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.

Re: Set Cookie

Posted: Wed Nov 28, 2018 4:41 pm
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 

Re: Set Cookie

Posted: Wed Nov 28, 2018 4:51 pm
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);

Re: Set Cookie

Posted: Wed Nov 28, 2018 5:17 pm
by dilfich
Thank!