开发者

Android WebView can render HTML going forward, but not backward

I'm using a WebViewClient that overrides shouldOverrideUrlLoading so the browsing stays inside the WebView. I initially call loadDataWithBaseURL with some HTML I have in memory, which has links in it. When I click the links, they load correctly in the webView.

Everything is good up till now, but when I press back, effectively calling webView.goBack(), the webView loads the failUrl I passed to loadDataWithBaseURL.

Why do开发者_JAVA技巧es it work going forward, but not going backward?


I found a solution, but I still feel like this is still an Android bug. You just have to keep track of the depth of browsing and when it gets to 0 you have to call loadDataWithBaseURL rather than webView.goBack(). Seems like a hack though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜