You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Odoo 8中集成Facebook页面插件iframe?报错求助

修正Odoo 8中嵌入Facebook页面的XML代码

我来帮你排查并修复这段代码,先梳理下原代码里的几个关键问题,再给出调整后的可用版本:

核心修改点

  • Form版本适配:Odoo 8对应的XML表单版本应该是8.0,而非原代码中的7.0,版本不匹配会导致渲染逻辑异常。
  • 布局样式优化:原代码的绝对定位会让iframe直接覆盖页面其他元素,改成相对定位并设置合理的固定高度,适配Odoo的表单容器布局。
  • 兼容性与安全属性调整:给iframe添加全屏兼容属性,同时确保sanitize="False"的位置正确(Odoo的QWeb渲染需要这个属性允许加载外部iframe资源)。
  • 参数细节优化:调整iframe的宽度参数为100%,让插件自适应容器宽度,同时修正frameborder属性值为0(原代码的no不符合标准写法)。

修正后的完整代码

<form string="Embedded Webpage" version="8.0" edit="false" create="false">
    <div style="width:100%; height:600px; overflow:hidden; position:relative;">
        <iframe 
            src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2Fkissabebe&tabs=timeline&width=100%&height=600&small_header=true&adapt_container_width=true&hide_cover=false&show_facepile=true&appId=164011430896983"
            sanitize="False"
            width="100%"
            height="100%"
            marginwidth="0"
            marginheight="0"
            frameborder="0"
            scrolling="no"
            style="border:none;"
            webkitallowfullscreen
            mozallowfullscreen
            allowfullscreen
        ></iframe>
    </div>
</form>

额外提示

如果插件还是无法正常加载,可以先尝试移除appId参数测试(部分基础Facebook页面插件无需应用ID也能运行),同时检查Odoo系统设置里的安全选项,确认没有阻止外部资源加载的限制。

内容的提问来源于stack exchange,提问作者Dalila Hannouche

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:48:06