问题描述
我想拦截的URL点击在我的WebView。我想从入门推出的时候,他们被点击的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.
对于我重写 shouldOverrideUrlLoading
方法。但还是什么都为返回的true / false
的URL是越来越启动。
For that I am overriding shouldOverrideUrlLoading
method. But still what ever is return true/false
that url is getting launched.
例如,如果我想阻止 http://www.xyz.com
我能够获得的URL字符串,并能与我的黑名单网址varify,但返回值是越来越发动无关。
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
推荐答案
尝试这样的事情
@Override
public boolean shouldOverrideUrlLoading(WebView wView, String url)
{
if(url.equals("from your list")){
//DO something
}
return true;
}
不过我不相当的的记住布尔value.just试试看......
however i dont quite remeber the boolean value.just give it a try....
这篇关于阻止某些网址的安全性在android的web视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!