3

I am making Highlighter for Android in WebView.

For the highlighting purpose, in one example i am using JQuery and Rangy, in another pure Javascript and XPath. I am trying the same Highlight in Desktop Browsers also.

Please refer to the previous questions which i posted for the problems which i am facing during Highlighting...

-->> Problem when using XPath

-->> Problem when using Rangy (Not answered yet!)

So... from the responses to these question, i came to the conclusion that

the DOM structure of the loaded HTML in WebView is inconsistent and different than that of the same HTML page loaded in Desktop Browser mostly with reference to "TextNodes"..

To support this conclusion, i have created a jsFiddle (link in the question). But, i also think that WebView may not be changing the DOM structure but it surely returns incorrect TextNodes inside a div...

Now the question is, is there any way to stop this change in DOM structure of the HTML in WebView? Any insight guys?

Community
  • 1
  • 1
Neernay
  • 379
  • 1
  • 4
  • 13
  • I know this question is old, but I came across the same problem recently and found that the inconsistent DOM structure was actually due to some javascript in a library that was used to handle WebView text selection. Without that selection library, the DOM structure remains consistent. So probably, somewhere in the code, something is modifying the HTML. – Samantha May 18 '17 at 12:42

0 Answers0