【问题标题】:Add iframe to Appcelerator application将 iframe 添加到 Appcelerator 应用程序
【发布时间】:2017-09-01 21:45:52
【问题描述】:

我需要使用 iframe 在我正在开发的应用程序中显示视频的第一帧。

我的 webView 是这样的:

var myWebView =  Ti.UI.createWebView({
    height : deviceHeight * 0.04,
    width : deviceHeight * 0.04,
    left : deviceWidth * 0.03,
    backgroundColor : "red",
    url : "/local.html",
});

这是我的 local.html:

<html>
    <body>
        <iframe width="100" height="100" src="https:(myLink) frameborder="0"></iframe>
    </body>
</html>

问题是框架加载但没有占据我的整个 WebView。

或者有没有更好的方法来使用 JavaScript 将 iframe 加载到 appcelerator 中的 WebView?

我不知道你是怎么做到的。

对此有什么建议吗?

【问题讨论】:

    标签: android ios iframe appcelerator youtube-iframe-api


    【解决方案1】:

    你真的需要 iframe 吗?设置链接的 URL 也可以。

    一种方法是设置元视口:https://www.w3schools.com/css/css_rwd_viewport.asp

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    如果 iframe 应该是全屏的(不是 100 像素),它会是这样的:

    <body style="margin:0px;padding:0px;overflow:hidden">
        <iframe src="http://www.youraddress.com" frameborder="0" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%"></iframe>
    </body>
    

    【讨论】:

      猜你喜欢
      • 2012-04-14
      • 2014-03-15
      • 1970-01-01
      • 1970-01-01
      • 2015-07-31
      • 1970-01-01
      • 1970-01-01
      • 2010-10-07
      • 2016-04-13
      相关资源
      最近更新 更多