日期:2014-05-18 浏览次数:20952 次
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { //获取网站关键词,就是key words这个 foreach (HtmlElement h in webBrowser1.Document.GetElementsByTagName("head")) { } }
private void DisplayMetaDescription() { if (webBrowser1.Document != null) { HtmlElementCollection elems = webBrowser1.Document.GetElementsByTagName("META"); foreach (HtmlElement elem in elems) { String nameStr = elem.GetAttribute("name"); if (nameStr != null && nameStr.Length != 0) { String contentStr = elem.GetAttribute("content"); MessageBox.Show("Document: " + webBrowser1.Url.ToString() + "\nDescription: " + contentStr); } } } }