怎么样才能禁止webbrowser跳转
比如在webbrowser里点一个超级链接,要跳到另一个页面,如何禁止webbrowser跳转不设置Enabled
处理 NewWindow2 事件 和 BeforeNavigate2 事件。
Option Explicit
Dim bIsLoading As Boolean
Private Sub Form_Load()
bIsLoading = True
WebBrowser1.Navigate "http://bbs.bc-cn.net"
bIsLoading = False
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 bIsLoading = False Then
Cancel = True
End If
End Sub
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
If bIsLoading = False Then
Cancel = True
End If
End Sub
[此贴子已经被作者于2007-1-3 22:08:57编辑过]