Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,459 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,830 people online right now. Registration is fast and FREE... Join Now!




find url link

 
Reply to this topicStart new topic

find url link

Javil
31 Jul, 2008 - 03:28 AM
Post #1

New D.I.C Head
*

Joined: 31 Jul, 2008
Posts: 2

Hello,

i'm trying to make an app that finds an url link.
So when i click a button, VB search a link with
a certain name.

Example : So VB search the webpage for a link with the name 'insect' and click on it.

Is this possible, and so, how?


CODE
WebBrowser1.Navigate("www.test.com")


Thanx
User is offlineProfile CardPM
+Quote Post

Javil
RE: Find Url Link
1 Aug, 2008 - 10:46 AM
Post #2

New D.I.C Head
*

Joined: 31 Jul, 2008
Posts: 2

anyone?
User is offlineProfile CardPM
+Quote Post

Zhalix
RE: Find Url Link
1 Aug, 2008 - 11:23 AM
Post #3

D.I.C Head
**

Joined: 7 May, 2008
Posts: 218



Thanked: 9 times
My Contributions
Well, you'd have to be searching through the HTML and not the outputted text in order to detect links. To get the HTML, use this line of code to put the HTML into a string of your choice:

CODE
String = WebBrowser1.Document.documentElement.Outerhtml


Use the InStr() function to search for "<a href" (make sure to specify that it not be case-sensitive), and then when it finds that particular tag, have it find the next ">", and then make it look at the text between the ">" and the "<a/>".

You'll need to go through another process where it removes all tags from the text you've found as a link, because it may contain text-modifiers like "<b>" and whatnot. After that, simply check if it's the appropriate text.

If the text turns out to be right, then have it take the text from between the first quote and second quote that is within the prior "<a href" tag, and make your browser navigate there. This may need some work as web pages linking to inner pages of their own website will probably not be providing the full URL to the location of the page.

This isn't exactly step-for-step as I left out some important details like that you have to have it remember the locations of all these tags, but this is a way to do it, and definitely the way I would.

This post has been edited by Zhalix: 1 Aug, 2008 - 11:28 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 04:00PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month