question about extracting HTML anchors

conception_native_0123

Well-known member
Local time
Today, 07:30
Joined
Mar 13, 2021
Messages
1,923
in VBA, this is all that is needed in order to extract an 'a' tag's hyperlink address using internet explorer:
Code:
aTagVal = ie.Document.getElementsByTagName("a")(0)
so for this code:
HTML:
<a href="https://rachael-adamiak.square.site" target="_blank">View Website</a>
my code gets this:
Code:
https://rachael-adamiak.square.site
but should it not get this instead?
Code:
View Website
my code is asking for the 'a''s value, not the HREF, which is what is technically being returned. HREF is a property of the element 'a', so I would assume that more code would be needed. I'm just curious. anyone else done this? thanks.
 
internetexplorer.application will not work with the new edge (or windows 0/11?).
so you will need to shift to xmlhttp object.

you can then manually look for <a href>, clean that part of the text and
just extract "View Website".
 
internetexplorer.application will not work with the new edge (or windows 0/11?).
i'm using microsoft internet controls. IE still works with that. but i'm still on win 10.
 

Users who are viewing this thread

Back
Top Bottom