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.

prevent new windows from opening when browsing

Post Reply
ericktux
Posts: 23
Joined: Thu Oct 29, 2020 10:11 am

prevent new windows from opening when browsing

Post by ericktux »

Hello friend, greetings and thank you for sharing, a question, how can I make all the searches open in the same window and thus prevent them from opening in new windows, I have tried several demos and the same thing happens.
please help
ericktux
Posts: 23
Joined: Thu Oct 29, 2020 10:11 am

Re: prevent new windows from opening when browsing

Post by ericktux »

Hello friends, at the moment this works:
in the event "NewWindowRequested" i put

Code: Select all

procedure TMiniBrowserFrm.WVBrowser1NewWindowRequested(Sender: TObject;
  const aWebView: ICoreWebView2;
  const aArgs: ICoreWebView2NewWindowRequestedEventArgs);
var
  TempArgs : TCoreWebView2NewWindowRequestedEventArgs;
begin
  // This demo blocks new windows
  TempArgs         := TCoreWebView2NewWindowRequestedEventArgs.Create(aArgs);
  //ShowMessage(TempArgs.URI);
  WVBrowser1.Navigate(TempArgs.URI); // open URL in the same window
  TempArgs.Handled := True;
  TempArgs.Free;
end;
Post Reply