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.

How to Capture a New Window

Post Reply
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to Capture a New Window

Post 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.
Post Reply