Android WebView - get url redirected to, without loading the page in the webview -


i trying access a.com, in turn redirects me b.com , loads in webview.

how address a.com redirects without loading in webview?

string postdata = "session=" + session;     webview.posturl(urlpassedfromarguments,             encodingutils.getbytes(postdata, "base64"));      webview.setwebviewclient(new webviewclient() {          @override         public void onreceivederror(webview view, int errorcode,                 string description, string failingurl) {              if (isadded() && getactivity() != null)                 toast.maketext(getactivity(), description,                         toast.length_short).show();          }          @override         public void onpagefinished(webview view, string url) {             try {                 dialog.dismiss();             } catch (exception e) {             }             super.onpagefinished(view, url);             logger.e("onpagefinished url", url);              if (!resolvedurlloaded) {                 string postdata = "token=" + token;                 webview.posturl(url,                         encodingutils.getbytes(postdata, "base64"));                 resolvedurlloaded = true;             }         }      }); 

use shouldoverrideurlloading:

@override public boolean shouldoverrideurlloading (webview view, string url) {     // url loaded     return true|false; } 

returns true if host application wants leave current webview , handle url itself, otherwise return false.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -