Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android webview shouldOverrideUrlLoading is not called

In my application, shouldOverrideUrlLoading() is not called on Honeycombe 3.2 version. I have tested it on 2.2 and 4.0.1 and they all are working fine.

Is it a bug in Honeycomb? How can I work around it?

I need to send the custom header for every request in shouldOverrideUrlLoading()

view.loadUrl(url,headers);

Thanks in advance.

like image 379
Riddle Avatar asked Mar 30 '12 09:03

Riddle


1 Answers

This method will only be called when the user performs the navigation. It won't always be called if the website redirects the user. A common scenario for this is a website using AJAX to change the content of the page or redirect the user.

Check out the other callbacks in WebViewClient to find one that fits your needs: onLoadResource, onPageStarted. In your case you are targetting API level 11+, so shouldInterceptRequest is also available to you.

like image 180
Zambotron Avatar answered Sep 21 '22 09:09

Zambotron