VB6 - WebBrowser HTML button intercept click
Hi,
When a page loads, I need to intercept one of the Named buttons that appear on screen and stop the button opening another page, when clicked by the User.
I would presume that it will happen in BeforeNavigate, but what code do I use to destroy the call to the HTML page under the clicked button?
Thanks.
Re: VB6 - WebBrowser HTML button intercept click
Re: VB6 - WebBrowser HTML button intercept click
Code:
Private Sub Command1_Click()
WebBrowser1.Navigate "http://www.some-website.com"
End Sub
Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
If InStr(URL, "http://www.some-website.com") > 0 Then
If MsgBox("Do you want to see the page?", vbYesNo, "See Page?") = vbYes Then
Cancel = False
Else
Cancel = True
End If
End If
End Sub
Re: VB6 - WebBrowser HTML button intercept click
jmsrickland, that should do the trick. Many thanks to yourself and westconn1 for answering.
Cheers.