initialization
GlobalWebView2Loader := TWVLoader.Create(nil);
GlobalWebView2Loader.UserDataFolder := ExtractFileDir(Application.ExeName) + '\CustomCache\' + IntToStr(Random(10000));
GlobalWebView2Loader.ProxySettings.Server := 'http://Host:port'; //http://geo.~~~.com:12321
GlobalWebView2Loader.StartWebView2;
procedure TMDIChild.WVBrowser1BasicAuthenticationRequested(Sender: TObject;
const aWebView: ICoreWebView2;
const aArgs: ICoreWebView2BasicAuthenticationRequestedEventArgs);
var
AuthResponse: ICoreWebView2BasicAuthenticationResponse;
UserNameStr, PasswordStr: string;
begin
var Uri: PWideChar;
if aArgs.Get_uri(Uri) = S_OK then
ShowMessage('Authentication requested for: ' + Uri);
if aArgs.Get_Response(AuthResponse) = S_OK then
begin
UserNameStr := '~~'; // Basic Authentication ID
PasswordStr := '~~'; // Basic Authentication PW
AuthResponse.Set_UserName(PWideChar(UserNameStr));
AuthResponse.Set_Password(PWideChar(PasswordStr));
aArgs.Set_Cancel(0);
end;
end;
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.