TadvWebBrowser Popup

Hi,


The TAdvWebBrowserPopup class is to show the browser inside a popup window. This is not related to blocking popup windows from clicking on an URL or link inside the browser itself. We have investigated this hower and the add_NewWindowRequest interface implementation is capable of doing that. The next version of TAdvWebBrowser will have this interface on board. You can use the following code to block all new windows.



uses
  AdvWebBrowser.Win;


type
  TCoreWebView2NewWindowRequestedEventHandler = class(TInterfacedObject, ICoreWebView2NewWindowRequestedEventHandler)
  public
    function Invoke(sender: ICoreWebView2; args: ICoreWebView2NewWindowRequestedEventArgs): HRESULT; stdcall;
  end;




procedure TForm90.FormCreate(Sender: TObject);
var
  c: ICoreWebview2Controller;
  w: ICoreWebView2;
  t: EventRegistrationToken;
begin
  c := ICoreWebView2Controller(AdvWebBrowser1.NativeBrowser);
  if c.get_CoreWebView2(w) = S_OK then
  begin
    w.add_NewWindowRequested(TCoreWebView2NewWindowRequestedEventHandler.Create, @t)
  end;




  AdvWebBrowser1.Navigate('http://tmssoftware.com');
  AdvWebBrowser1.ControlAlignment := caClient;
end;


{ TCoreWebView2NewWindowRequestedEventHandler }


function TCoreWebView2NewWindowRequestedEventHandler.Invoke(
  sender: ICoreWebView2;
  args: ICoreWebView2NewWindowRequestedEventArgs): HRESULT;
begin
  args.put_Handled(False);
  Result := S_OK;
end;

[/CODE]