4

I am trying to allow user to login into our application through a WebView, but when trying to login, I get an error saying ERR_TOO_MANY_REDIRECTS. The login protocol consists of 5 redirects, but we have no control over it.

It works in a web browser, but Anroid WebView starts thinking we are in a redirect loop and cancels the whole thing. Up until API 8 there was a function onTooManyRedirects(WebView view, Message cancelMsg, Message continueMsg), which allowed you to continue, but is now not used anymore.

What can I do to get around this problem?

Luka
  • 435
  • 1
  • 7
  • 18

1 Answers1

3

In my code I have the following line:

webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);

Just deleting this line solve the issue.

4b0
  • 21,981
  • 30
  • 95
  • 142
Petros Mosoyan
  • 238
  • 2
  • 15
  • why is this solution working?. I'm looking for other solutions as this solution may result in unexpected behaviors. – mrzbn Jul 23 '22 at 10:54