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.
Delete cookies and cache without destroying TChromium
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Delete cookies and cache without destroying TChromium
Hi,
I need to delete the cookies (and the cache) without destroying already created TChromium components. To delete the cookies i manually delete the files inside the GlobalCEFApp.Cookies folder.
Problem is i can't do it in runtime because Windows will say the files are in use. To delete it, i need to close my app, go to the folder manually , delete the files and then open my app again.
Is there another to delete the files without closing my app ?
Thanks
I need to delete the cookies (and the cache) without destroying already created TChromium components. To delete the cookies i manually delete the files inside the GlobalCEFApp.Cookies folder.
Problem is i can't do it in runtime because Windows will say the files are in use. To delete it, i need to close my app, go to the folder manually , delete the files and then open my app again.
Is there another to delete the files without closing my app ?
Thanks
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Delete cookies and cache without destroying TChromium
Just another info : even if i destroy TChromium, for some reason some files on Cookies dir keep locked ; the only way to delete them is closing the app.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Delete cookies and cache without destroying TChromium
You can delete the cookies with TChromium.DeleteCookies even if your app is running but as far as I know, there's no CEF3 function to clear the cache at run time.thefunkyjoint wrote: Wed Jan 03, 2018 3:10 pm Hi,
I need to delete the cookies (and the cache) without destroying already created TChromium components. To delete the cookies i manually delete the files inside the GlobalCEFApp.Cookies folder.
Problem is i can't do it in runtime because Windows will say the files are in use. To delete it, i need to close my app, go to the folder manually , delete the files and then open my app again.
Is there another to delete the files without closing my app ?
Thanks
There are some workarounds with similar effects :
- Use TChromium.ReloadIgnoreCache to reload the web page ignoring the cache.
- Create a new TChromium with a new Request Context that uses a different cache directory. Take a look at the TChildForm.FormShow procedure in the MDIBrowser demo.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Delete cookies and cache without destroying TChromium
That's how CEF3 works. You can't delete those files before you destroy GlobalCEFApp.thefunkyjoint wrote: Wed Jan 03, 2018 3:17 pm Just another info : even if i destroy TChromium, for some reason some files on Cookies dir keep locked ; the only way to delete them is closing the app.
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Delete cookies and cache without destroying TChromium
Hi Salvador,salvadordf wrote: Wed Jan 03, 2018 3:44 pmYou can delete the cookies with TChromium.DeleteCookies even if your app is running but as far as I know, there's no CEF3 function to clear the cache at run time.thefunkyjoint wrote: Wed Jan 03, 2018 3:10 pm Hi,
I need to delete the cookies (and the cache) without destroying already created TChromium components. To delete the cookies i manually delete the files inside the GlobalCEFApp.Cookies folder.
Problem is i can't do it in runtime because Windows will say the files are in use. To delete it, i need to close my app, go to the folder manually , delete the files and then open my app again.
Is there another to delete the files without closing my app ?
Thanks
There are some workarounds with similar effects :
- Use TChromium.ReloadIgnoreCache to reload the web page ignoring the cache.
- Create a new TChromium with a new Request Context that uses a different cache directory. Take a look at the TChildForm.FormShow procedure in the MDIBrowser demo.
Thanks for the answer. I could not find a 'DeleteCookies' method in TChromium... is it a new method for the recent versions ? I'm still on a couple of commits behind the most recent.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Delete cookies and cache without destroying TChromium
DeleteCookies was available in the first public release of CEF4Delphi almost a year ago.thefunkyjoint wrote: Wed Jan 03, 2018 4:37 pmI could not find a 'DeleteCookies' method in TChromium... is it a new method for the recent versions ? I'm still on a couple of commits behind the most recent.
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Delete cookies and cache without destroying TChromium
I found the function, called it but somehow when i close the app and open again, i'm still logged in the site , so the cookies were not deleted...
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Delete cookies and cache without destroying TChromium
Please, download CEF4Delphi again and try the new TChromium.DeleteCookies function.
Now it uses the right cookie manager in case you created a custom request context in your browsers.
https://www.briskbard.com/forum/viewtopic.php?f=8&t=251
Now it uses the right cookie manager in case you created a custom request context in your browsers.
https://www.briskbard.com/forum/viewtopic.php?f=8&t=251