【问题标题】:Frameset does not diplay pages框架集不显示页面
【发布时间】:2016-09-14 14:39:21
【问题描述】:

我的网页有 2 个水平的<frame>s。第二个<frameset> 分为2 列<frameset>。

现在,当我单击第一个<frame> 的外部链接时,它应该将页面加载到第二列的<frame>。

我已经命名了两个框架,并在 href 上添加了目的地。

查看示例页面:

index.html

<!DOCTYPE html>
<html>
<frameset rows="25%,*">
  <frame src="title.html">
  <frame src="frames.html">
</frameset>
</html>

title.html

<!DOCTYPE html>
<html>
<marquee>
<b>
Welcome
</b>
</marquee>
</html>

frames.html

<!DOCTYPE html>
<html>
<frameset cols="15%,*">
  <frame src="menu.html" name="menu_page">
  <frame  name="main_page">
</frameset>
</html>

menu.html

<!DOCTYPE html>
<html>
<a href="http://www.google.com" target="main_page">Google</a>
<br /><br />
<a href="http://www.microsoft.com" target="main_page">Microsoft</a>
<br /><br />
</html>

【问题讨论】:

    标签: html hyperlink frame frameset


    【解决方案1】:

    这是现代网络服务器和浏览器的一项安全功能。如果您查看浏览器的控制台日志,您可能会看到如下内容:

    Refused to display 'https://www.google.co.uk/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
    

    Google 特意设置了X-Frame-Options 响应标头,表明

    是否应允许浏览器以&lt;frame&gt;、&lt;iframe&gt; 或&lt;object&gt; 呈现页面。网站可以使用它来避免点击劫持攻击,确保其内容不会嵌入到其他网站中。

    浏览器正在停止您的网页嵌入另一个网站。有一些变通方法,但不尊重网站作者的意愿被认为是不好的做法 - 请参阅 Overcoming "Display forbidden by X-Frame-Options"。

    【讨论】:

      猜你喜欢
      • 2020-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-13
      • 2017-08-20
      相关资源
      最近更新 更多