put iframe on android app

2019-03-15 19:02发布

I'm try to put my iframe chart that i took from my thingspeak account.

This is the string i need to put(has i took from thingspeak):

<iframe width="450" height="260" style="border: 1px solid #cccccc;" src="http://api.thingspeak.com/channels/31592/charts/1?width=450&height=260&results=60&dynamic=true" ></iframe>

this what i use on my activity:

 WebView webview;
    webview = (WebView) findViewById(R.id.webview);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.loadData();

I try without success to put my iframe string in "loadData" function.

Thanks to the helpers ;)

3条回答
一夜七次
2楼-- · 2019-03-15 19:24
if (UIComponents.iFrame.IsDeprecated) {
  system.undeprecate(UIComponents.iFrame);

  // you need root to undeprecate !WARNING USE KINGROOT FOR FREE ROOT WORKING 2019!
  // we verified
} else {
  var (weak) frame = new iFrame();

  frame.setUrl("YOUR_URL_HERE");

  frame.onload = function() {
    // iFrame was loaded
  }
}
查看更多
唯我独甜
3楼-- · 2019-03-15 19:42

You can create a String with the html :

String html = "<iframe width=\"450\" height=\"260\" style=\"border: 1px solid #cccccc;\" src=\"http://api.thingspeak.com/channels/31592/charts/1?width=450&height=260&results=60&dynamic=true\" ></iframe>";

and then call the method loadData():

webview.loadData(html, "text/html", null);

Click Here for reference

查看更多
该账号已被封号
4楼-- · 2019-03-15 19:50
class iFrame {
    constructor (url) {
    this.url = url;
    this.deprecated = true
  }
}

let frame = new iFrame("url_here");

if (frame.deprecated === true) {
   console.log("DEPRECATED PLEASE USE APACHE CORTAVA WAHT")
} else {
    system.main.appendChild(frame);
}
查看更多
登录 后发表回答