Page 1 of 1

Avoid websites opening in new tab / window

Posted: Mon Feb 26, 2018 1:29 pm
by thefunkyjoint
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 !

Re: Avoid websites opening in new tab / window

Posted: Mon Feb 26, 2018 2:59 pm
by salvadordf
Use TChromium.OnBeforePopup and add this code to block new tabs, new windows and new popup windows :

Code: Select all

Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
Many demos use that code except MiniBrowser and PopupBrowser.

Re: Avoid websites opening in new tab / window

Posted: Mon Feb 26, 2018 4:57 pm
by thefunkyjoint
Thank you Salvador ! :D

Re: Avoid websites opening in new tab / window

Posted: Mon Feb 26, 2018 6:22 pm
by thefunkyjoint
Is there a way to make the popup url open inside the current TChromium instance, instead of only blocking it ?

Re: Avoid websites opening in new tab / window

Posted: Mon Feb 26, 2018 6:23 pm
by thefunkyjoint
Nervermind, i got it ; just need to use the targetUrl parameter to navigate to the popup url.