Usually, when you click inside Android WebView page and transfer to another page, WebViewClient
receives call to shouldOverrideUrlLoading
method. But, this doesn't work with money.cnn.com. When I browse on money.cnn.com, I receive callbacks only into onPageStarted
and into onPageFinished
. Both only once. Browsing inside the site after doesn't give any callbacks to WebViewClient
. If I browse only inside the money.cnn.com my log shows only these two lines. No more, no less.
> 10-14 14:10:25.581 28886-28886/com.myapp I/MyApp: onPageStarted
> 10-14 14:10:36.822 28886-28886/com.myapp I/MyApp: onPageFinished
My code is:
mWebView.setWebViewClient(mSWWebViewClient);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.loadUrl(getUrl());
WebViewClient mSWWebViewClient = new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
Log.d("MyApp", "onPageStarted ");
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
Log.d("MyApp", "onPageFinished ");
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.d("MyApp", "shouldOverrideUrlLoading ");
}
};
My question is why shouldOverrideUrlLoading
doesn't receive callback at all, and how can I detect a change of the content of this site while browsing through it?
Edition Finally, I have finished with the solution https://stackoverflow.com/a/40551880/955321