We're using WebViews to display web pages behind a https scheme and intentionally display "insecure content" (non-https resources) on it for performance but the WebView constantly outputs logcat warning messages. Is there anyway to disable/hide them?
It can technically leak sensitive URLs to anything that can read the logcat output, so it would be really great to be able to hide it.
07-10 11:42:56.198: W/Web Console(32423): The page at https://secure_url displayed insecure content from http://insecure_url.
It's possible.
Just override WebViewClient for your WebView like this:
webView.setWebChromeClient(new WebChromeClient()
{
@Override
public boolean onConsoleMessage(ConsoleMessage cm) {
Log.d("TAG", cm.message() + " at " + cm.sourceId() + ":" + cm.lineNumber());
return true;
}
});
You can of course comment out the log line or just create a Log class and disable logging when doing release build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With