nishi
nishi

Reputation: 1265

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

Upvotes: 5

Views: 5857

Answers (1)

Its not blank
Its not blank

Reputation: 3095

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....

Upvotes: 3

Related Questions