Page 1 of 1

Re: How to Capture a New Window

Posted: Fri Aug 09, 2019 8:06 am
by salvadordf
There're 2 events triggered just before a new window is created :
  • TChromium.OnBeforePopup
  • TChromium.OnOpenUrlFromTab
Read this for all the details about those events : As you can see, OnOpenUrlFromTab is rarely triggered but OnBeforePopup is more frequently used.

You can use those events to cancel the creation of the new window when targetDisposition is WOD_NEW_POPUP or WOD_NEW_WINDOW, and create your own tab with the same URL.

Those events are called in a CEF thread and you should not create VCL controls or forms inside that event because VCL doesn't like to create and destroy controls in different threads.

If you decide to create your own popup forms or tabs you can use the PopupBrowser2 demo as a template.