How to force WebView to skip images?
Can someone a开发者_如何学Cdvice me how to tune up Android WebView to skip images from remote server (without image placeholders)
Try using :
webView.getSettings().setLoadsImagesAutomatically(false);
webView.getSettings().setLoadsImagesAutomatically(false);
webView.getSettings().setBlockNetworkLoads (true);
webView.getSettings().setBlockNetworkImage(true);
and in webview onPageFinished
webView.loadUrl("javascript:(function(){ var imgs=document.getElementsByTagName('img');"+
"for(i=0;i<imgs.length;i++) { imgs[i].style.display='none'; } })()");
In onCreate webView.getSettings().setBlockNetworkImage(true);
In onPageFinished of WebViewClient webView.getSettings().setBlockNetworkImage(false);
精彩评论