标题:怎么样才能禁止webbrowser跳转
只看楼主
121038
Rank: 1
等 级:新手上路
威 望:2
帖 子:414
专家分:0
注 册:2005-8-3
 问题点数:0 回复次数:1 
怎么样才能禁止webbrowser跳转
比如在webbrowser里点一个超级链接,要跳到另一个页面,如何禁止webbrowser跳转

不设置Enabled
搜索更多相关主题的帖子: webbrowser Enabled 链接 页面 超级 
2007-01-03 12:48
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
得分:0 

处理 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编辑过]


天津网站建设 http://www./
2007-01-03 22:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-113908-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.458098 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved