clear browser history

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.

clear browser history

Postby Gionter » Wed Oct 30, 2024 12:29 pm

Quick way to clear browser history without going into settings? Thanks in advance.
Gionter
Newbie
 
Posts: 5
Joined: Mon Oct 14, 2024 6:36 pm

Re: clear browser history

Postby ndesktop » Wed Oct 30, 2024 6:15 pm

Delete files History and History-journal from cache_path ?
ndesktop
Master
 
Posts: 845
Joined: Thu Dec 03, 2015 10:10 am

Re: clear browser history

Postby Gionter » Wed Oct 30, 2024 6:45 pm

ndesktop wrote:Delete files History and History-journal from cache_path ?


Yes, clear SQLite DB file with name - History, and others like it.
Gionter
Newbie
 
Posts: 5
Joined: Mon Oct 14, 2024 6:36 pm

Re: clear browser history

Postby Gionter » Thu Oct 31, 2024 6:38 am

ndesktop wrote:Delete files History and History-journal from cache_path ?


I can only delete them if I unload the browser completely from memory, otherwise the system won't let me delete them.
Gionter
Newbie
 
Posts: 5
Joined: Mon Oct 14, 2024 6:36 pm

Re: clear browser history

Postby ndesktop » Thu Oct 31, 2024 5:11 pm

Programmatically, I think HistoryService::ExpireHistoryBetween is what is needed for a programmatic clear. But I don't remember HistoryService being intercepted/overriden in CEF.

I don't know how the history service can and should be operated, but one may start from ChromeBrowserContext::AddVisitedURLs implementation as a first example: get the profile with AsProfile(), history service with HistoryServiceFactory::GetForProfile(profile, ServiceAccessType::IMPLICIT_ACCESS) or perhaps ServiceAccessType::EXPLICIT_ACCESS, and call ExpireHistoryBetween with min and max time values (there are examples in history service unit test).
ndesktop
Master
 
Posts: 845
Joined: Thu Dec 03, 2015 10:10 am

Re: clear browser history

Postby Gionter » Sat Nov 02, 2024 7:38 am

ndesktop wrote:Programmatically, I think HistoryService::ExpireHistoryBetween is what is needed for a programmatic clear. But I don't remember HistoryService being intercepted/overriden in CEF.

I don't know how the history service can and should be operated, but one may start from ChromeBrowserContext::AddVisitedURLs implementation as a first example: get the profile with AsProfile(), history service with HistoryServiceFactory::GetForProfile(profile, ServiceAccessType::IMPLICIT_ACCESS) or perhaps ServiceAccessType::EXPLICIT_ACCESS, and call ExpireHistoryBetween with min and max time values (there are examples in history service unit test).


What would it look like in the api of other languages? C#, for example.
Gionter
Newbie
 
Posts: 5
Joined: Mon Oct 14, 2024 6:36 pm

Re: clear browser history

Postby ndesktop » Sat Nov 02, 2024 8:18 am

Not sure. I do not have much experience with CefSharp, but I'm sure these methods use data types already there.
ndesktop
Master
 
Posts: 845
Joined: Thu Dec 03, 2015 10:10 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 23 guests