Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a webview. Everything is working fine but when I am opening a page which has iframe, the iframe is not getting visible. Are there any specific settings required?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
844 views
Welcome To Ask or Share your Answers For Others

1 Answer

First add Hardware Acceleration and add the following lines to your webView

webView.setWebChromeClient(new WebChromeClient());

EDIT 1

It will be hard to identify the problem but try adding WebChromeClient, WebViewClient and also don't forget to enable javascript before loading URL like this

webView= (WebView) findViewById(R.id.webview); 
webView.setWebChromeClient(new WebChromeClient()); 
webView.setWebViewClient(new WebViewClient()); 
webView.getSettings().setJavaScriptEnabled(true);

EDIT 2

If you really need to load content of iframe then Try using Jsoup to load html page but you have to find the iframe and fetch the content manually.

Document doc=...
Element iframe1 = doc.select("#iframe1").first();

if (iframe1!=null) {
   Document iframeContent = Jsoup.connect(iframe1.attr("src")).get();

  }

where iframe1 is id of your iframe.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...