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.

Secret mode or Incognito

Post Reply
sodlf159
Posts: 90
Joined: Thu Nov 09, 2023 1:55 pm

Secret mode or Incognito

Post by sodlf159 »

WVBrowser1.IsInPrivateModeEnabled := True;
WVBrowser1.CreateBrowser(WVWindowParent1.Handle);

or

procedure TMainForm.WVBrowser1NavigationStarting(Sender: TObject;
const aWebView: ICoreWebView2;
const aArgs: ICoreWebView2NavigationStartingEventArgs);
begin
if not isReSet then
begin
isReSet := True;
WVBrowser1.ClearBrowsingDataAll;
Sleep(100);
WVBrowser1.Refresh;
end;
end;
User avatar
salvadordf
Posts: 4563
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Secret mode or Incognito

Post by salvadordf »

Setting IsInPrivateModeEnabled to True is the preferred method.
sodlf159
Posts: 90
Joined: Thu Nov 09, 2023 1:55 pm

Re: Secret mode or Incognito

Post by sodlf159 »

WindowlessBrowser

Can you give me an example of how to control clicks?
And the window does not disappear.
User avatar
salvadordf
Posts: 4563
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Secret mode or Incognito

Post by salvadordf »

Modify the TMainForm.HandleMouseMessage function to filter the mouse clicks.
If necessary, avoid the WVBrowser1.SendMouseInput call for some clicks.
sodlf159
Posts: 90
Joined: Thu Nov 09, 2023 1:55 pm

Re: Secret mode or Incognito

Post by sodlf159 »

The window doesn't disappear?
It's not headless mode.
User avatar
salvadordf
Posts: 4563
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Secret mode or Incognito

Post by salvadordf »

The WindowlessBrowser uses the DirectComposition API :
https://github.com/MicrosoftEdge/WebView2Feedback/issues/20
https://docs.microsoft.com/en-us/windows/win32/directcomp/directcomposition-portal

A true headless browser may use an off-screen rendering mode like the OSR mode in CEF but that feature is still not implemented by Microsoft :
https://github.com/MicrosoftEdge/WebView2Feedback/issues/547

The WindowlessBrowser demo allows you to have more control over mouse events but the application still has to initialize the browser using a TWVDirectCompositionHost instance.
Post Reply