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.
精彩评论