Today a lot of websites use AJAX to display content. Below are the 2 examples of how to load pages with AJAX, and how not to:
1. Add reference to SHDocVw.dll, and a multiline Textbox to your form. This code will not load AJAX content.
VB Code:
Option Explicit
Dim WithEvents myWeb As SHDocVw.InternetExplorer
Private Sub Form_Load()
Set myWeb = New SHDocVw.InternetExplorer
myWeb.Navigate "http://video.yandex.ru/#search?text=test"
Do While myWeb.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
Set myWeb = Nothing
End Sub
Private Sub myWeb_DownloadComplete()
On Error Resume Next
Text1.Text = myWeb.Document.body.innerHTML
End Sub
2. Add SHDocVw.dll as a component and place a WebBrowser control on your form; and add a multiline Textbox as well. This code does pretty much the same thing as the code above, except it will load AJAX content.
VB Code:
Option Explicit
Private Sub Form_Load()
WebBrowser1.Navigate "http://video.yandex.ru/#search?text=test"
Do While WebBrowser1.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
End Sub
Private Sub WebBrowser1_DownloadComplete()
On Error Resume Next
Text1.Text = WebBrowser1.Document.body.innerHTML
End Sub
Ref: http://en.wikipedia.org/wiki/Ajax_(programming)
P.S. I used http://video.yandex.ru/#search?text=test only as an example, as most of the content on that page is loaded with AJAX. Feel free to test the code on any other page like Google or Yahoo.
I'd love to see other examples of how to load AJAX-enabled pages. Please do post any suggestions.