Jump to content
Sign in to follow this  
EugeneK

Changing UserDataFolder in TWebBrowser with webview

Recommended Posts

Hi

 

When using TEdgeBrowser directly it is possible to set custom UserDataFolder property value. Is there a way to set it when using TWebBrowser with Edge engine? (Delphi 11 if that matters)

Edited by EugeneK

Share this post


Link to post
18 hours ago, EugeneK said:

Hi

 

When using TEdgeBrowser directly it is possible to set custom UserDataFolder property value. Is there a way to set it when using TWebBrowser with Edge engine? (Delphi 11 if that matters)

Well, TWebbrowser (in D11) has a protected method

    function GetEdgeInterface: TEdgeBrowser;

To get at it you can use a cracker class, e.g. declared in the implementation section of the form unit containing the TWebbrowser control.

type
  TWebBrowserCracker = class(TWebbrowser);

In your code you can then do something like

var Edge: TEdgeBrowser := TWebbrowserCracker(Webbrowser1).GetEdgeInterface;
if Assigned(Edge) then begin
  Edge.UserDataFolder := SomeDirectory;
  Edge.ReinitializeWebView;
end;

Completely untested, so use at your own risk!

  • Like 2
  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×