I have a web browser control, already navigated to a page. Now I want to search for a specific text in the page, and scroll to the first occurrence.
Being able to scroll to other occurrences is a bonus.
I have a web browser control, already navigated to a page. Now I want to search for a specific text in the page, and scroll to the first occurrence.
Being able to scroll to other occurrences is a bonus.
I don't know if it works in a WebBroswer
. We make the broswer(IE/FF/etc) window scroll to some text with the following code:
//source code of http://www.sample.com/sample.html
<html>
...
<span name="aim">KeyWord</span>
...
</html>
If I want the window to scroll to the "KeyWord", simply visit http://www.sample.com/sample.html#aim
Using string document = myWebBrowser.DocumentText
to get the source code of the page, and search the text in the string, get its node name, and navigate it using #
.