简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM