The basic idea is to alter every url being loaded in a webview (for example adding/removing get parameters).
I have a custom WebViewClient
, in which I have the following method :
public boolean shouldOverrideUrlLoading(WebView view, String url) {
String modifiedUrl = Util.someMethod(url);
super.shouldOverrideUrlLoading(view, modifiedUrl);
}
Will it work or should I put this logic in another method, for example onPagestarted
?
You rather should do something like :
Calling
super.shouldOverrideUrlLoading(view, modifiedUrl)
won't work because, as it is its name, this method only checks if the url should be overridden, and does not load the url at all.