Results 1 to 3 of 3

Thread: Webbrowser question

  1. #1

    Thread Starter
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611

    Question Webbrowser question

    With the WebBrowser object this is called as I open a new window

    WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)


    But how can I extract the URL of the new window?

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    You could put another hidden browser on the form, and do this...
    VB Code:
    1. Private Sub Command1_Click()
    2.     WebBrowser1.Navigate "http://www.vbforums.com"
    3. End Sub
    4.  
    5. Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    6. Dim wb As New WebBrowser_V1
    7.    
    8.     Set ppDisp = WebBrowser2.Object
    9.  
    10. End Sub
    11.  
    12. Private Sub WebBrowser2_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, _
    13.                                         Flags As Variant, TargetFrameName As Variant, _
    14.                                         PostData As Variant, Headers As Variant, _
    15.                                         Cancel As Boolean)
    16.     MsgBox URL
    17. End Sub
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Fanatic Member Kzin's Avatar
    Join Date
    Dec 2000
    Posts
    611
    Originally posted by crptcblade
    You could put another hidden browser on the form, and do this...
    VB Code:
    1. Private Sub Command1_Click()
    2.     WebBrowser1.Navigate "http://www.vbforums.com"
    3. End Sub
    4.  
    5. Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
    6. Dim wb As New WebBrowser_V1
    7.    
    8.     Set ppDisp = WebBrowser2.Object
    9.  
    10. End Sub
    11.  
    12. Private Sub WebBrowser2_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, _
    13.                                         Flags As Variant, TargetFrameName As Variant, _
    14.                                         PostData As Variant, Headers As Variant, _
    15.                                         Cancel As Boolean)
    16.     MsgBox URL
    17. End Sub
    That's ingenious - thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width