3

With the TEdgeBrowser.OnNewWindowRequested event, I can obviously tell that a new window is about to open, but how can I capture the output to my own custom TForm with a second TEdgeBrowser component?

Zhorov
  • 28,486
  • 6
  • 27
  • 52

1 Answers1

5

The TEdgeBrowser.OnNewWindowRequested event handler has a parameter named Args of type TNewWindowRequestedEventArgs, which implements Edge's ICoreWebView2NewWindowRequestedEventArgs interface. You can call its put_NewWindow() method, providing it with the ICoreWebView2 interface of the desired browser window, which you can get from the TEdgeBrowser.DefaultInterface property.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Thanks for the answer. That's basically what I suspected, but it doesn't seem to work. Not sure what I'm missing. Maybe a version issue? I'm using Delphi 10.4.1 Sydney, and there is no put_NewWindow(), but there is a Set_NewWindow(), which is what I used, Args.ArgsInterface.Set_NewWindow(EdgeBrowser2.DefaultInterface), but no joy. – Stan Campsmith Mar 24 '21 at 13:31
  • 1
    Ooops! Stupid programmer trick. I got it working, thanks! – Stan Campsmith Mar 24 '21 at 14:36
  • Thanks! This worked for me in C++Builder: Args->ArgsInterface->Set_NewWindow(WB->DefaultInterface), but put_NewWindow() did not work. – Albert Wiersch Oct 29 '21 at 17:33