Click to See Complete Forum and Search --> : WebBrowser Object
Dubi
Apr 13th, 2000, 12:06 AM
I am using the WebBrowser object in vb6.
When a link is clicked on a web page, I need to retrieve information from the ahref link. Is this possible??
Example:
<a href="http://www.blah.com/index.html" target="main">
I need to retrieve the 'target = main'.
If anyone can help....i'd appreciate it.
lata
dubi
CarlosTheJackal
Apr 13th, 2000, 03:05 AM
Hey- I dont think you can directly detect it in vb without some complex subclassing, but in the webbrowsers BeforeNavigate2, it passes you the url and the headers and postdata of the page it is about to navigate to, so you can probably get what you want there.
Thnx For Your Time,
CarlosTheJackal
[Edited by CarlosTheJackal on 04-13-2000 at 04:07 PM]
Dubi
Apr 13th, 2000, 05:39 AM
Thanks CarlosTheJackal. Ill give it a shot. Thanks for the fresh perspective.
lata
dubi
asabi
Apr 13th, 2000, 11:34 AM
Try this:
Private Sub Command1_Click()
Inet1.Execute ("www.whatever.com")
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
If State = icResponseCompleted Then
Do
content = Inet1.GetChunk(1000)
Text1.Text = Text1.Text + content
Loop While content <> ""
End If
End Sub
add microsoft internet transfer control to your form
add a command button and a text box
and cut and paste this code.
you can through it into a variable, and than parse all the "target" ones.
Dubi
Apr 13th, 2000, 11:06 PM
Hey thanks for the input asabi. One problem that I am still experiencing is........
The directory window that will be used for navigation has a long list of hyperlinks. All of these links target "main". How do I differentiate between which hyperlink is clicked?
Example....
<a href="/corporate/corp1.html" target="main">Office Lobby</a><BR>
<a href="/corporate/corp2.html" target="main">Press Room</a><BR>
<a href="/corporate/corp3.html" target="main">Human Resources</a><BR>
<a href="/corporate/corp4.html" target="main">Communications</a><BR>
<a href="/corporate/corp5.html" target="main">Board Room</a><BR>
<a href="/corporate/corp6.html" target="main">File Room</a><BR>
If I attempt to retrieve the information via WebBrwoser1.locationURL --- It only gives me the URL to the directory. ie. "http://www.blah.com/directory.html"
I need the actual URL to the hyperlink that is clicked.
Any Ideas???? Thanks everyone for helping out with this. Ive been stumped for quite a few days now. Any advice is appreciated.
lata
dubi
asabi
Apr 14th, 2000, 12:04 AM
Let me understand, you want to make your own web browser ?? :-)
The guy clicks on something, and you want to get the url that he clicked on before it goes there ?
Alon
asabi
Apr 14th, 2000, 12:07 AM
I just thought about something:
You can make a dynamic FORM that will populate buttons, each button will go to another link (the program builts it when the page loads), and than when someone presses the button, you can trap it !
Tell me what you think / questions ..
Dubi
Apr 14th, 2000, 01:02 AM
Ok...let me try n' clarify to make things a lil easier. I am creating a web browser for http://www.okid.com . If you go to this site and click on the top left corner of the homepage (Enter oKID Now). This will display a flash animation with a frameset on the left hand side. On the bottom of the frameset, click Directory. A new window is generated which contains a list of links. When I click on one of these links......I would like the page displayed inside the "main" frame of the original browser window. If I use the NewWindow2 Event and set my original browser as the newWindow....it blows out the frameset on the main browser. If I attempt force the navigation using BeforeNavigate2 Event......It sends the http://www.okid.com/directory.html into the browser (the page with all the links.) I think this is because the webbrowser1.locationURL is always http://www.okid.com/directory.html the link just uses an A HREF Tag to target the "main" frame.
I hope this clears things up. Thanks very much for takin the time to look at this.
dubi
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.