Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Tip: How to prevent New Window in Web Browser control
Message
De
03/12/2008 17:50:18
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Tip: How to prevent New Window in Web Browser control
Divers
Thread ID:
01365420
Message ID:
01365420
Vues:
102
This message has been marked as the solution to the initial question of the thread.
If anyone's tried to prevent the Web Browser control from opening IE when the user clicks a link which specifies a "new _blank target window", here's how. Note: I searched and didn't find any solution on this, so please excuse me if it's been pointed out and I missed it.

1) In your VFP form, add "two" web browser controls. Don't make the second one visible, as it will not be shown.

2) In the main (first) web browser control's NewWindow2 event, add this:
LPARAMETERS ppdisp, cancel
* use our hidden browser control in order to get the url
* note, can't get url from BeforeNavigate2
ppdisp= thisform.xoleweb2
3) in the second web browser control's NavigateComplete2 event, add this:
LPARAMETERS pdisp, url
* send url to first browser control. we compare to avoid recursive calls from popups
IF NOT thisform.xoleweb1.LocationUrl == this.locationUrl
	thisform.xoleweb1.Navigate2(this.locationURL)
ENDIF
4) in the second web browser control's NewWindow2 event, add this:
LPARAMETERS ppdisp, cancel
* avoid popups. this has same effect as cancel. note, cancel=.t. doesn't work
ppdisp= this
Hope this helps someone.
Aloha, -Mark
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform