My Android app uses a WebView to display a bunch of HTML code that I generate \'on the fly\'. The HTML code is loaded using the following code:
First of all, you don't need to use javascript. If you loaded content with
webContents.loadDataWithBaseURL("some://dummy/url",...);
you can simply scroll to anchor with
webContents.loadUrl("some://dummy/url#anchor");
Secondly, doing that on onPageFinished without additional control results in never ending loop! When loadUrl finishes onPageFinished get's called again and again.