Android WebView client shouldOverrideUrlLoading() method is not getting called for redirect urls -
i trying intercept code redirect instagram authentication. i'm using shouldoverrideurlloading() stop page loading, webview goes ahead , loads anyway. here code
public boolean shouldoverrideurlloading(webview view, webresourcerequest request) { string url = view.geturl(); if (url.startswith("https://someurl.com")){ return true; } return false; }
found out using webview url instead of url webresourcerequest, following code string url = view.geturl(); should string url = string.valueof(request.geturl(); , whole method so:
public boolean shouldoverrideurlloading(webview view, webresourcerequest request) { string url = string.valueof(request.geturl(); if (url.startswith("https://someurl.com")){ return true; } return false; }
Comments
Post a Comment