4

I have a question on the Android webview.

Assume URL A redirects to URL B at the server side.

My android application when it tries to open URL A in webview, it automatically redirects to URL B.

If a URL is being redirected to some other url, I see both these urls are stored in webview history. Now my webview history consists of [URL x, URL y, .... URL A, URL B ]

On back key click from URL B webpage, webview will try to load URL A, which again redirects to URL B. We need to double click back key twice rapidly, to go back beyond URL A

How do I solve this issue ? Is there a way to tell webview, not to put redirecting URLs in history or any other options ?

Thanks.

1 Answer 1

1

I'm not an expert but if you know the basic URL information of the sites you wish to ignore, maybe you can look into the doUpdateVisitedHistory method for the WebViewClient. You might be able to do something like:

@Override public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) { if ( url.contains("you.site") ) // do nothing else super.doUpdateVisitedHistory(view, url, isReload); } 
Sign up to request clarification or add additional context in comments.

1 Comment

default implementation of doUpdateVisitedHistory() is empty

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.