Android-AdvancedWebView
Android-AdvancedWebView copied to clipboard
goBack() is loading the same page, when the page is redirected
When I check out an article on twitter, it is successfully opening the page after multiple redirects but the problem comes when I press the back button then it loads the last URL (that's the redirecting URL of the current page) and end up showing the current page again.
Log scheme:
Org: <URL from webview.getOriginalUrl()> Url: <URL from webview.getUrl()>
Thanks a lot for mentioning this!
The problem is that we override WebViewClient#shouldOverrideUrlLoading and always return false, intercepting the request and sending a new request via our custom version of WebView#loadUrl, as you can see here.
This is useful only if you have custom HTTP headers defined, as you can see here. But even then, not sure if we want those side effects.
We should probably replace
// route the request through the custom URL loading method
view.loadUrl(url);
// cancel the original request
return true;
with just
// pass through the original request
return false;
but that would break custom HTTP headers for non-manual, subsequent requests. But those are broken for POST requests, etc., anyway.