After some research I conclude that despite what most of the tutorials out there say, shouldOverrideUrlLoading()
does not get called when:
You load a URL like
loadUrl("http://www.google.com");
The browser redirects the user automatically via an HTTP Redirect.
It does however, get called when you you click on a link inside a webpage inside the webview. IIRC the twitter authorization uses an HTTP Redirect.. Bummer, this would be helpful if it worked how all the tutorials say it does. I think this is from a very old version the Android API...
/*
* 有些情况不会触发这个方法,所以需要在onPageStarted里进行补漏捕获
* 比如:
* webview第一次加载loadurl loadUrl("http://www.google.com");
* HTTP Redirect跳转
* 有时网页用脚本进行网页跳转(暂时忘了具体情况,待测)
* 经测location.href、location.replace、window.open进行跳转能捕获到
*/
posted on 2012-06-09 13:15
汪杰 阅读(2953)
评论(0) 编辑 收藏 引用 所属分类:
Java