Page 1 of 1

popups in fmxchromium browser

Posted: Tue Mar 26, 2019 11:50 am
by padamjain
Hi,

I have implemented FMXChromium in my firemonkey application.
I have web page with pop ups, when i click on buttons the pop up should open, which is not happening in my case.
any advise ? is it possible to have a popup ?

Regards

Re: popups in fmxchromium browser

Posted: Tue Mar 26, 2019 1:35 pm
by salvadordf
There are 2 ways to handle popup windows :
  • Letting CEF create all the popup windows.
  • Manage the popup windows yourself.
The MiniBroser demo lets CEF create the popup windows and the PopupBrowser and PopupBrowser2 demos create the popup windows manually.

PopupBrowser uses popup windows in OSR mode and PopupBrowser2 uses popup windows in normal mode.

Creating popup windows is complicated because CEF executes the events in threads and the VCL needs to create and destroy all controls in the main thread. Read the code comments in those demos for more details.

The rest of the demos block all new popups, tabs and windows to keep them as simple as possible.

If you need an easy way to have popup windows I would suggest you use the MiniBrowser method. Use the TChromium.OnBeforePopup to block any unwanted windows and add TChromium.IsSameBrowser(browser) calls to the TChromium events because CEF will use the same event procedures for the main browser and all the popup browsers.