I have a webview in which am loading an xhtml. I have a string in the page, say "Machine Head" which is unique, i.e., it is the only word which is present. I need to find the offset(pixel) of that string using javascript so that I can scroll accordingly. Am not able to find a function that will take String as an input and return the pixel offset of the position from where the string begins.
Asked
Active
Viewed 78 times
1 Answers
0
There is no such function. Can you add an anchor and navigate to it instead? So add <a href='#machine_head' />
in your page and call webView.loadUrl("http://....html#machine_head");
? Alternavively you could try using JavaScript to scroll to the right element as described here.

Community
- 1
- 1

marcin.kosiba
- 3,221
- 14
- 19