我用WebBrowser控件的时候如何能得到全部的html源码呢?
因为有的网页返回值为如下:
<--status ok 200 --->
xxxxxx说明文字
<html>
....................
</html>
xxxxxxxxxxx我目前用的是如下函数获取源码的,但获取不到html标签之外的代码,请教各位大哥帮忙:
Public Function webBrowseContent(WebBrowser As WebBrowser)
Set vDoc = WebBrowser.Document
'获取网页的源码
For Each o In vDoc.All
DoEvents
htmlpage = htmlpage & o.innerHTML
Next
webBrowseContent = htmlpage
End Function
Call URLDownloadToFile(0, "网页地址", "保存到本地文件名和地址", 0, 0)
Dim gourl As String
gourl = StrConv("网页地址", vbUnicode)
Call DoFileDownload(gourl)
要不你试一下
xmlHttp.responseText
或者
BytesToBstr(xmlHttp.responseBody, "GB2312")
你自己都试试看
因为找不不lz说的那种网页
lz自己是试吧 估计也没戏
另外注意doevents的位置Private Sub Command1_Click()
WebBrowser1.Navigate "c:\222.html"
Do While WebBrowser1.Busy
DoEvents
Loop
Label1 = webBrowseContent(WebBrowser1)End SubPublic Function webBrowseContent(WebBrowser As WebBrowser)
DoEvents
Set vDoc = WebBrowser.Document
'获取网页的源码
For Each o In vDoc.All
htmlpage = htmlpage & o.innerHTML
Next
webBrowseContent = htmlpage
End Function