Search code examples
delphitedgebrowser

How can I redirect a TEdgebrowser popup window to my own form?


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?


Solution

  • 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.