【问题标题】:Iframe in sencha Touchsencha Touch 中的 iframe
【发布时间】:2014-11-19 10:35:05
【问题描述】:

我需要在我的 Android 应用程序中使用类似 facebook 的按钮 iframe...如果我使用此代码,我会在我的 PC 桌面上看到它,但我在 Android 中看不到任何内容。

您知道为什么以及是否存在在 Android 中显示点赞按钮的方法吗? 我正在使用 Sencha Architect 和 Touch 2.3 谢谢

<iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2FFacebookDevelopers&amp;width&amp;height=62&amp;colorscheme=light&amp;show_faces=false&amp;header=false&amp;stream=false&amp;show_border=false&amp;appId=780849738633803" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:62px;" allowTransparency="true"></iframe>

【问题讨论】:

  • 如何添加。在带有 setHtml 或 ... 的容器内
  • 如你所说。我创建了一个容器,然后设置了 HTML

标签: iframe sencha-touch sencha-architect facebook-iframe


【解决方案1】:

如你所说。

这是我的代码:

htmlStrBase1 = '<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fopticaltrend12345%2F&amp;width&amp;layout=button&amp;action=like&amp;show_faces=false&amp;share=false&amp;height=35&amp;appId=780849738633803" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:35px;" allowTransparency="true"></iframe>';
component.add({
        xtype: 'container',
        id: 'fb-root',
        width: 50,
        height: 20,
        flex:1,
    listeners: {
        initialize : function (container) {
            (function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id)) return;
                js = d.createElement(s); js.id = id;
                js.src = "//connect.facebook.net/en_US/all.js";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));
            container.setHtml(htmlStrBase);
        }
    }
});

【讨论】:

  • 嗯。如果您使用容器,则容器内有严重的 div。这样 #fb-root.x-inner.x-innerHtml 就是真正的 fb html 部分开始的地方。您是否尝试过使用组件而不是容器。您应该构建一个 fb 自定义组件。
  • 你能给我写一个小例子吗?
  • 看看模板部分中的 yourProject.touch.src.Button.js,您可以定义一个 div 或 span ...并添加您的文本或 html。每次 configItem 更改时都会调用 updateConfigItem。这应该可以让你很好地控制你的 fb like。
猜你喜欢
  • 2014-04-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-27
  • 2012-03-07
相关资源
最近更新 更多