-1

I have an app that reads a jpg file and displays the embedded GPS location on a google map using a TChromiumWindow.CreateBrowser component. (Delphi Berlin and CEF4Delphi latest version). Every time I run it I have to accept or deny cookies.

How do I make it remember my cookie choice ?

I have tried setting up a ICefCookieManager cookie manager but there is no option to set a cookie store and the cache folder remains empty. Also looked at a number of GlobalCefApp ideas I found on the internet without success.

273K
  • 29,503
  • 10
  • 41
  • 64
  • Does this answer your question? [How to set custom cookie data location in Chromium with CEF4Delphi](https://stackoverflow.com/questions/57994365/how-to-set-custom-cookie-data-location-in-chromium-with-cef4delphi) – 273K Oct 31 '22 at 03:40
  • 1
    Without writing down your code and linking found websites nobody knows what you actually tried. Also you could execute JavaScript when the displayed web page's DOM has finished rendered to either "accept" any displayed dialog (see [How can I auto accept cookies pop](https://stackoverflow.com/q/69602644/4299358)) or to remove it without clicking anything. – AmigoJack Oct 31 '22 at 07:23

1 Answers1

1

The cookies are saved with the cache files.

Set the cache directory in GlobalCEFApp.Cache before the GlobalCEFApp.StartMainProcess call in the DPR file like this :

GlobalCEFApp.Cache := 'c:\my_custom_cache_directory';

Make sure that the windows user executing your application has write privileges in the cache directory.

With this setting you will only have to deal with the "accept or deny cookies" dialog the first time you visit a web page or when the cookies expire.

  • Sorry, I did read this before posting but missed the fact that GlobalCEFApp.Cache had to be set in the dpr rather than in the pas. – Lorne Anderson Oct 31 '22 at 13:13
  • It can be anywhere as long as you set GlobalCEFApp.Cache before calling GlobalCEFApp.StartMainProcess. If you initialize GlobalCEFApp in a pas unit then you should set it in that unit. – Salvador Díaz Fau Oct 31 '22 at 13:58