WebBrowser1.Navigate url
是打开某网址但是如果我在这个网址打开一个连接,它又自动跳转到系统的默认浏览器了那么,在网站中打开一个连接后,还能自动启用webbrowser进行浏览呢

解决方案 »

  1.   

    get current urlnavigate url
      

  2.   

    在网上发现了两段代码:'原来的窗口
    Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Cancel = True
    WebBrowser1.Navigate2 WebBrowser1.Document.activeElement.href
    End Sub'新窗口
    Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    Dim NFrm As New Form1
    NFrm.WebBrowser1.RegisterAsBrowser = True
    Set ppDisp = NFrm.WebBrowser1.Object
    NFrm.Visible = True
    End Sub
    好像可以用
    但是有好多问题不懂哎,请大家指点一二1.Document.activeElement.href到底是什么意思啊
    2.NewWindows2事件里的ppdisp到底是什么啊?
      

  3.   

    activeElement.href活动元素地址,ppdisp加载的浏览器窗体框架对象
      

  4.   

    我搜藏的方法:'将新窗口在webbrowser中打开
    Dim WithEvents Web_V1 As SHDocVwCtl.WebBrowser_V1Private Sub Form_Load()
        Set Web_V1 = WebBrowser1.Object
    End Sub
        
    Private Sub Web_V1_NewWindow(ByVal URL As String, ByVal Flags As Long, ByVal TargetFrameName As String, PostData As Variant, ByVal Headers As String, Processed As Boolean)
        Processed = True
        WebBrowser1.Navigate URL
    End Sub
      

  5.   

    activeElement Property  Internet Development Index --------------------------------------------------------------------------------Retrieves the object that has the focus when the parent document has focus.Syntax[ oActive = ] document.activeElement
    Possible ValuesoActive Object that receives the element that has the focus. The property is read-only. The property has no default value.
      

  6.   

    如果以我这可怜的英文水平能看懂MSDN,那猪都会飞了
    555555555现在才知道,编程不懂英文是多么可怜
      

  7.   

    额,我首次接触编程就是VB,现在VB用惯了,换其他的不舒服啊