【问题标题】:How to solve 'x-frame-options' to 'sameorigin' in ionic4 for Iframe?如何在 Iframe 的 ionic4 中将“x-frame-options”解决为“sameorigin”?
【发布时间】:2019-06-22 20:28:09
【问题描述】:

我正在尝试在 Iframe 中使用一些 URL,但是当我尝试将该 Iframe 嵌入 Ionic4 应用程序时,我收到了这个错误。

拒绝在框架中显示“https://twitter.com/afdonews”,因为它将“X-Frame-Options”设置为“sameorigin”。

我的 iframe 代码是

<iframe width="100%" height="100%" src="https://twitter.com/afdonews" scrolling="no" style="border: 0;" (load)="hideLoading()">
</iframe>

你能帮我吗?

【问题讨论】:

  • 这意味着 Twitter 不允许网站在 iframe 中显示 twitter,除非是他们这样做

标签: ionic-framework iframe angular6 ionic4 x-frame-options


【解决方案1】:

试试这个:

 <a class="twitter-timeline" href="https://twitter.com/afdonews?ref_src=twsrc%5Etfw">afdonews</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

或者使用这样的东西:

<iframe border=0 frameborder=0 height=250 width=550 
 src="https://twitframe.com/show?url=https%3A%2F%2Ftwitter.com%2Fjack%2Fstatus%2F20"></iframe>

这是因为 Twitter 不允许网站在 @Mehdi 在评论中建议的 iframe 中显示 twitter。

我希望这会有所帮助!谢谢!

【讨论】:

    猜你喜欢
    • 2021-05-09
    • 1970-01-01
    • 2017-06-05
    • 2012-08-24
    • 1970-01-01
    • 2014-04-30
    • 1970-01-01
    • 1970-01-01
    • 2013-04-30
    相关资源
    最近更新 更多