WebBrowser点击连接,如何取得被点击的连接?(20)

  • 主题发起人 主题发起人 L.Ming
  • 开始时间 开始时间
L

L.Ming

Unregistered / Unconfirmed
GUEST, unregistred user!
看看下面的的事件发生过程,我点击的仅是http://www.21cn.com/,本来希望在BeforeNavigate2事件中根据用户如何点击了http://www.21cn.com/而进行一些操作,但是现在BeforeNavigate2发生了N次,而用户仅是点击了一次。如何才能区别哪些连接是用户点击的,哪些是程序自动载入的?BeforeNavigate2:http://www.21cn.com/NavigateComplete2:http://www.21cn.com/BeforeNavigate2:http://guba.finance.21cn.com/other/index_calendar_1.jspBeforeNavigate2:http://finance.21cn.com/dyif/topindexv2/index.shtmlBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu1&db=ad21cn&border=0&local=yesBeforeNavigate2:http://www.21cn.com/weekly/gundong/index.shtmlBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_r1&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu2&db=ad21cn&border=0&local=yesBeforeNavigate2:http://img.vgo.21cn.com/clientv3/21cnindex/tv.htmlBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_r2&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_l1&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu3&db=ad21cn&border=0&local=yesBeforeNavigate2:http://review.21cn.com/home_page_review.htmlBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_l2&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu4&db=ad21cn&border=0&local=yesNavigateComplete2:http://guba.finance.21cn.com/other/index_calendar_1.jspNavigateComplete2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu1&db=ad21cn&border=0&local=yesNavigateComplete2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_r1&db=ad21cn&border=0&local=yesNavigateComplete2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu2&db=ad21cn&border=0&local=yesNavigateComplete2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_r2&db=ad21cn&border=0&local=yesDocumentComplete:http://guba.finance.21cn.com/other/index_calendar_1.jspNavigateComplete2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_l1&db=ad21cn&border=0&local=yesNavigateComplete2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu3&db=ad21cn&border=0&local=yesNavigateComplete2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu4&db=ad21cn&border=0&local=yesNavigateComplete2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_l2&db=ad21cn&border=0&local=yesDocumentComplete:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_r1&db=ad21cn&border=0&local=yesDocumentComplete:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu1&db=ad21cn&border=0&local=yesDocumentComplete:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_l2&db=ad21cn&border=0&local=yesDocumentComplete:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu2&db=ad21cn&border=0&local=yesDocumentComplete:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_r2&db=ad21cn&border=0&local=yesDocumentComplete:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu3&db=ad21cn&border=0&local=yesDocumentComplete:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_l1&db=ad21cn&border=0&local=yesDocumentComplete:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu4&db=ad21cn&border=0&local=yesNavigateComplete2:http://www.21cn.com/weekly/gundong/index.shtmlNavigateComplete2:http://img.vgo.21cn.com/clientv3/21cnindex/tv.htmlDocumentComplete:http://img.vgo.21cn.com/clientv3/21cnindex/tv.htmlNavigateComplete2:http://review.21cn.com/home_page_review.htmlDocumentComplete:http://www.21cn.com/weekly/gundong/index.shtmlDocumentComplete:http://review.21cn.com/home_page_review.htmlNavigateComplete2:http://finance.21cn.com/dyif/topindexv2/index.shtmlDocumentComplete:http://finance.21cn.com/dyif/topindexv2/index.shtmlDocumentComplete:http://www.21cn.com/
 
其实很简单每次点击都触发二次吗?那你就做个计数器
 
好像有个url属性可用
 
to 爱妹妹的哥哥:BeforeNavigate2事件不止激发两次,是14次,而且不同的网址,激发的次数也不同,你怎么做计数?BeforeNavigate2:http://www.21cn.com/BeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_l1&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_l2&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_r1&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|button_r2&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu1&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu2&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu3&db=ad21cn&border=0&local=yesBeforeNavigate2:http://custom21cn.allyes.cn/main/adfshow?user=21cn|www|hengfu4&db=ad21cn&border=0&local=yesBeforeNavigate2:http://finance.21cn.com/dyif/topindexv2/index.shtmlBeforeNavigate2:http://guba.finance.21cn.com/other/index_calendar_1.jspBeforeNavigate2:http://img.vgo.21cn.com/clientv3/21cnindex/tv.htmlBeforeNavigate2:http://review.21cn.com/home_page_review.htmlBeforeNavigate2:http://www.21cn.com/weekly/gundong/index.shtmlto lxw5214:我的连接就是用URL属性中提出来的,问题是我不知道如何区分哪些是用户点的,哪些是自动载入的。上面除了第一个,其他的都是自动载入的。但是用户不一定是点www.21cn.com呀,到时我怎么区分?
 
根据http原理来说,用户点击的应该是最先访问的也是最早触发beforenavigate2的链接。获取页面源码后,由于该页面包含(比如子框架,图片等链接),因此webbrowser就取这些子链接,再取的时候触发相应beforenavigate2事件,这些顺序反而不是固定的。
 
接受答案了.
 
后退
顶部