开发者

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);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜