CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Tuesday, October 03, 2006

Problem: Underlying HTML from a selection inside WebBrowser Control produces different HTML than the original page

Problem: Underlying HTML from a selection inside WebBrowser Control produces different HTML than the original page

Monday, September 25, 2006, 7:43:54 PM | ASP.NET BlogsGo to full article
here's a problem I've been trying to deal with: the WebBrowser control in .NET 2.0 Winforms. I'm trying to get the selected text's underlying HTML representation, and it works, kind of. IHTMLDocument2 doc2 = browser.Document.DomDocument as IHTMLDocument2;IHTMLTxtRange range = doc2.selection.createRange() as IHTMLTxtRange; string plainTextSelection = range.text; string selectionHtmlText = browser.DocumentText; string fullHtmlText = browser.DocumentText; My problem is that the html text from the selection range is different from that of the original HTML underlying the whole document. the bolder variable contain different HTML, which obviously produces the same result but one of them was generated dynamically by the web browser control (or so...(read more)

Post a Comment