Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Tip: How to prevent New Window in Web Browser control
Message
From
03/12/2008 17:50:18
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Tip: How to prevent New Window in Web Browser control
Miscellaneous
Thread ID:
01365420
Message ID:
01365420
Views:
101
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
Next
Reply
Map
View

Click here to load this message in the networking platform