Hi,
Certain websites when opened, open another url in a new tab or window and in this case, this url will open in a window outside the my app. Is there a way to avoid / block that behaviour ?
Thanks !
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.
Avoid websites opening in new tab / window
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Avoid websites opening in new tab / window
Use TChromium.OnBeforePopup and add this code to block new tabs, new windows and new popup windows :
Many demos use that code except MiniBrowser and PopupBrowser.
Code: Select all
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Avoid websites opening in new tab / window
Thank you Salvador ! 

-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Avoid websites opening in new tab / window
Is there a way to make the popup url open inside the current TChromium instance, instead of only blocking it ?
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Avoid websites opening in new tab / window
Nervermind, i got it ; just need to use the targetUrl parameter to navigate to the popup url.