Android WebView + loadUrl with javascript + onPageFinished = lag

前端 未结 2 738
情话喂你
情话喂你 2021-01-02 16:57

I have WebView which loads some page, when it\'s finished I apply some javascript magic to mess up with DOM. Everything is fine, page loads and onPageFinished I

相关标签:
2条回答
  • 2021-01-02 17:24

    Ok, I think I figured it out. We can have callback from the end of javascript that will fire "show view" - like here or here (with handler, because I wanted to update ui). But it wont change anything, the problem seems to be in rendering speed. It's just slow. So for now I'll just stick with 1 second delay after firing JS.

    0 讨论(0)
  • 2021-01-02 17:26

    I don't think you're going to get an easy solution to this. All that Android can detect (like most browsers) is when the page is fully loaded, which means, all of it is downloaded. Javascript waits for it to be downloaded also, and THEN starts running. It's just the way it works. The only solution I can think of might just be in JQuery. I don't know much about it but there's usually solutions to things like this in it.

    0 讨论(0)
提交回复
热议问题