Page 1 of 1
block pop-ups plz
Posted: Fri Nov 08, 2024 3:05 pm
by sodlf159
How do I block pop-ups asking me to select an app from appearing?
Chrome itself is currently updating its version.
A pop-up window will appear allowing you to select the page and open the link app in the format.
I want to block this.
Re: block pop-ups plz
Posted: Fri Nov 08, 2024 4:51 pm
by salvadordf
See the SimpleBrowser2 demo :
https://github.com/salvadordf/CEF4Delphi/blob/00bf20f147679db82d37cc69f37ff8663f90f2de/demos/Delphi_VCL/SimpleBrowser2/uSimpleBrowser2.pas#L143
Implement TChromiumCore.OnBeforePopup and TChromiumCore.OnOpenUrlFromTab
Set Result to TRUE when "targetDisposition" has any of these values : CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW
Re: block pop-ups plz
Posted: Sat Nov 09, 2024 12:10 am
by sodlf159
Thanks. Is there a similar function for WebView4?
Re: block pop-ups plz
Posted: Sun Nov 10, 2024 2:37 pm
by salvadordf
The KioskBrowser demo in WebView4Delphi shows how to block popup windows using the TWVBrowser.OnNewWindowRequested event :
https://github.com/salvadordf/WebView4Delphi/blob/b0cfcb2f551bb589e4ce6456b847d9e2aee2acc0/demos/Delphi_VCL/KioskBrowser/uKioskBrowser.pas#L179
Create a TCoreWebView2NewWindowRequestedEventArgs instance with "aArgs" and set its Handled property to True.
Read the code comments about TCoreWebView2NewWindowRequestedEventArgs for all the details.