Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Block certain URLs for security in android webview

I am trying to intercept the url click in my webview. I want to block certain urls from getting launched when they are clicked in webview.

For that I am overriding shouldOverrideUrlLoading method. But still what ever is return true/false that url is getting launched.

e.g if i want to block http://www.xyz.com I am able to get the url string and able to varify it with my black list urls but it is getting launched irrespective of return value.

I may be wrong at approach I need suggestion

like image 554
nishi Avatar asked Oct 23 '22 02:10

nishi


1 Answers

try something like this

 @Override
public boolean shouldOverrideUrlLoading(WebView wView, String url)
{
     if(url.equals("from your list")){
         //DO something
     }
    return true;
}

however i dont quite remeber the boolean value.just give it a try....

like image 184
Its not blank Avatar answered Oct 30 '22 00:10

Its not blank