snookie
asked on
WebBrowser DOM <link> problem
Hi all,
I'm going through the tags with this code:
For i = 0 To WebBrowser1.Document.All.l ength - 1
'Insert Images into tblImages
If WebBrowser1.Document.All(i ).Tagname = "IMG" Then
strSQL = "INSERT INTO tblImages (URL,SRC,ALT,Width,Height) VALUES ('" & Text1.Text & "','" & WebBrowser1.Document.All(i ).src & "','" & Replace(WebBrowser1.Docume nt.All(i). alt, "'", "''") & "'," & WebBrowser1.Document.All(i ).Width & "," & WebBrowser1.Document.All(i ).Height & ")"
rs.CommandText = strSQL
rs.Execute
End If
Next
I can get it to extract the <title> and <meta> tag info but soon as it hits the <link> tag it dies..
Does anyone have any ideas, please?
I'm going through the tags with this code:
For i = 0 To WebBrowser1.Document.All.l
'Insert Images into tblImages
If WebBrowser1.Document.All(i
strSQL = "INSERT INTO tblImages (URL,SRC,ALT,Width,Height)
rs.CommandText = strSQL
rs.Execute
End If
Next
I can get it to extract the <title> and <meta> tag info but soon as it hits the <link> tag it dies..
Does anyone have any ideas, please?
Can you give me an example URL where the above code fails? I am testing it and it is working just fine for me.
ASKER
hi ya,
thanks for reading. Following caused problems:
http://www.nikmakris.com/
note the two <link> in http://www.nikmakris.com/
my version of IE is 5.5 and I'm running Win2000 with SP2
http://www.yahoo.com/
is causing problem when a try and get the links with:
'Insert Hyperlinks into tblHyperlinks
If (WebBrowser1.Document.All( i).Tagname = "A") Or (WebBrowser1.Document.All( i).Tagname = "a") Then
If WebBrowser1.Document.All(i ).Href <> "" Then
strSQL = "INSERT INTO tblHyperLinks (URL,HREF,AnchorText) VALUES ('" & Text1.Text & "','" & WebBrowser1.Document.All(i ).Href & "','" & Replace(WebBrowser1.Docume nt.All(i). innerHTML, "'", "''") & "')"
rs.CommandText = strSQL
rs.Execute
End If
End If
http://dmoz.org/ works fine though..
cheers,
snookie..
thanks for reading. Following caused problems:
http://www.nikmakris.com/
note the two <link> in http://www.nikmakris.com/
my version of IE is 5.5 and I'm running Win2000 with SP2
http://www.yahoo.com/
is causing problem when a try and get the links with:
'Insert Hyperlinks into tblHyperlinks
If (WebBrowser1.Document.All(
If WebBrowser1.Document.All(i
strSQL = "INSERT INTO tblHyperLinks (URL,HREF,AnchorText) VALUES ('" & Text1.Text & "','" & WebBrowser1.Document.All(i
rs.CommandText = strSQL
rs.Execute
End If
End If
http://dmoz.org/ works fine though..
cheers,
snookie..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am running IE6 by the way
ASKER
Found it dude,
it was to do with the event on which the code ran.
I ran my code on:
Private Sub WebBrowser1_NavigateComple te2(ByVal pDisp As Object, URL As Variant)
you ran yours on:
Private Sub Command2_Click()
maybe my code was crashing as it was loading stylesheet or something, strange but its fixed...
thanks for the time mate...
it was to do with the event on which the code ran.
I ran my code on:
Private Sub WebBrowser1_NavigateComple
you ran yours on:
Private Sub Command2_Click()
maybe my code was crashing as it was loading stylesheet or something, strange but its fixed...
thanks for the time mate...
No problem, glad I could help. Funny how timing is everything in some cases.