【问题标题】:What are the benefits of not using an iframe to embed one site in another?不使用 iframe 将一个站点嵌入另一个站点有什么好处?
【发布时间】:2012-03-13 15:49:05
【问题描述】:

我正在研究 Disqus 和其他嵌入式 wigets 是如何实现的,我开始意识到他们没有使用封闭的 iframe 来运行他们的所有小部件。他们所做的是通过 JavaScipt 将元素动态附加到嵌入页面,然后在某些 iframe 中运行几乎每个表单或按钮。这样做有什么意义?难道他们不能将所有内容都包装在 iframe 中,然后通过某种跨域消息传递系统(例如 easyXDM)更改父窗口 URL(以允许导航)吗?谁能指出一些元素不在 iframe 中的好处?

【问题讨论】:

    标签: javascript ajax iframe cross-domain disqus


    【解决方案1】:
    1. iframe 中的代码可能无法设置 cookie,因为浏览器认为它是广告。

    2. iframe 内容无法控制外部 iframe 的大小,因此需要使用 javascript 创建 iframe,并且需要从外部加载 javascript,以便外部站点的总大小超过 iframe。

    【讨论】:

      猜你喜欢
      • 2018-02-15
      • 2014-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-28
      • 1970-01-01
      相关资源
      最近更新 更多