I use the following code to load a facebook like button inside a webview.
likeWebView = (WebView)findViewById(R.id.webview);
likeWebView.getSettings().setJavaScriptEnabled(true);
url ="http://www.facebook.com/plugins/like.php?" +
"href=" + URLEncoder.encode( "http://developers.facebook.com/docs/opengraph/" )
+ "&" +
"layout=button_count&" +
"show_faces=0&" +
"width=90&" +
"height=24&" +
"locale=en_IN" +
"colorscheme=light" ;
likeWebView.loadUrl( url );
the problem is when the user is signing in the process redirects him to a blank page, how do i intercept this webview request and cancel this action/close webview ?
public class WebViewPreLoad extends WebView{
public WebViewPreLoad(Context context) {
super(context);
}
public void loadUrl(String str){
if(str.contains("something"))
super.loadUrl(str);
else
hide this
}
}
of course you will have to find the correct "if" for ur case
also, do the same thing with
public void loadUrl(String url, Map<String,String> extraHeaders)
change the super statement to:
super.loadUrl(url, extraHeaders);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With