Positioning content in webview using javascript function in android

I have a problem with some things related to javascript and webview in android. I need to set on top some text that I have in a webView. I fill the webview with an epub. Each part of text to set on top, has the following tag: and above y have the following javascript function: In the activity I have: webView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { webView.loadUrl("javascript:window.scroll(0,findPos(document.getElementById('chapter1')))"); } }); But the scroll doesn't work. The chapter 1 is not positioned on top. How could I change this? Thanks in advance
I could resolve it! First of all on the epub file put this javascript code: [code] [/code]

以上就是Positioning content in webview using javascript function in android的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准