【问题标题】:how to execute https:// url in iframe如何在 iframe 中执行 https:// url
【发布时间】:2014-04-28 12:46:10
【问题描述】:

这是我的代码

<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>

<div id="container">
    <iframe src="https://google.com" style="width:1000px;height:1000px"></iframe>
</div>

</body>
</html>

和控制台中的错误,即

Refused to display 'https://www.google.co.in/?gws_rd=cr&ei=YE1eU9jPItDqrQe8g4GwCg' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

【问题讨论】:

  • 没有。框架选项标头响应指出您只能在请求时使用SAMEORIGIN

标签: php html codeigniter iframe


【解决方案1】:

问题与https无关。

查看错误信息:

 because it set 'X-Frame-Options' to 'SAMEORIGIN'

Google 明确告诉您的浏览器,只允许 google.com 在 iframe 中显示页面。

没有办法覆盖这种行为。这是 Google 的页面。

您最接近的方法是将内容复制到您自己的服务器并在那里显示。谨防国际版权法。

【讨论】:

  • 如果我删除 google.com 并放入 amazon.in 那么同样的错误
  • @MohitJain — 这只是意味着亚马逊正在给浏览器同样的指令。只有亚马逊被允许将亚马逊的页面放入框架中。
猜你喜欢
  • 2011-06-03
  • 1970-01-01
  • 1970-01-01
  • 2021-03-28
  • 1970-01-01
  • 1970-01-01
  • 2017-09-06
  • 1970-01-01
  • 2014-01-03
相关资源
最近更新 更多