Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi, is there any way to get the selected DOM node when we select a part of a web page in WebBrowser control?
Posted 19-Jul-11 2:36am
Comments
SAKryukov at 20-Jul-11 0:26am
   
Not quite clear, see the answer.
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If I understand this right you mean selection with the mouse, something you do before the clipboard "Copy" operation. The problem is: such selection does not select any certain node. It selects a fragment of the document in its rendered form, not DOM; such selection goes across the DOM nodes of different levels. For example, it can select part of paragraph, several nested tables with images and a part of anchor. I don't think the whole idea of such selection reflects the DOM structure or can be applicable to it.
 
—SA
  Permalink  
Comments
Ramalinga Koushik at 20-Jul-11 0:43am
   
Perfect +5.
SAKryukov at 20-Jul-11 0:43am
   
Thank you, Ramalinga.
--SA
KAMRAN00F at 20-Jul-11 16:08pm
   
Oh yes, you are right. So let's change the question; Getting the DOM node of the htmlNode that the mouse is over it, or is clicking on it. When a mouse is pointing somewhere in the web page, it is exactly on 1 html element (e.g. Text, or link or image...) so I think in this situation we can get the DOM node.
 
Actually there is a program that it does what I exactly want. It's "Visual Web Ripper" and you can download a trial version of that from here:
Download Visual Web Ripper 2.76.5 (zip file, 6MB)

 
I need same thing. That would be a grate help. Thx ;).
SAKryukov at 20-Jul-11 22:01pm
   
Yes, this should be possible in principle, but if existing HTML rendering engines do not provide this functionality (they do not obliged to provide it as there are no standards that would require it), it would mean creating a custom HTML rendering engine. If you look at WebBrowser IE-based control you will see that click and mouse click events are not supported and selection of cursor position is not supported. This is what you would really need as a minimum, but not supported.
 
You can look at open source HTML rendering engines, look at source code and get some understanding of how to approach to the problem: http://en.wikipedia.org/wiki/Comparison_of_web_browser_engines.
--SA
KAMRAN00F at 21-Jul-11 6:14am
   
I was thinking about what you said, you are right! I need an html renderer, thank you very much for the help. I will try it.
deshmukhsc at 13-Sep-11 4:55am
   
Hi
Any update on this question I am aslo looking for same

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Marcin Kozub 275
1 OriginalGriff 264
2 Sergey Alexandrovich Kryukov 215
3 Praneet Nadkar 197
4 Richard MacCutchan 182
0 OriginalGriff 8,048
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 20 Jul 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100