html - Firefox 阻止加载 HTML iframe
问题描述
我想使用 HTML iframe 加载另一个页面,但由于避免安全问题,Firefox 阻止了它。.
我试图将“https”更改为“http”,但它不起作用。
Firefox 显示的错误:
Firefox Can’t Open This Page
To protect your security, anouar.stencila.io will not allow Firefox to display the page if another site has embedded it. To see this page, you need to open it in a new window.
这是使用的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Reproducible Article</title>
</head>
<body>
<!-- The header of the file -->
<p>
<a
href="https://ojs3.josekarvalho.net/index.php/rp/article/view/87/176"
target="_blank"
>Link to HTML version</a
>
|
<a
href="https://ojs3.josekarvalho.net/index.php/rp/article/view/87/181"
target="_blank"
>Link to PDF version</a
>
</p>
<!-- The iframe to be shown - the link to the reproducible article allowfullscreen -->
<iframe
src="https://anouar.stencila.io/gentsch2020/"
frameborder="0"
style="position: absolute; top: 80px; left: 0; width: 100%; height: 100%"
scrolling="yes"
title="Reproducible Article"
></iframe>
</body>
</html>
解决方案
页面https://anouar.stencila.io/gentsch2020/提供以下X-Frame-Options标头:
x-frame-options: allow-from *.ojs3.josekarvalho.net
ALLOW-FROM
任何最新的浏览器都不支持,所以它不会工作。您要么需要尽可能使用SAMEORIGIN
,要么完全删除标题。
X-Frame-Options 可以替换为Content-Security-Policy: frame-ancestors <source>;
,请参阅MDN。
推荐阅读
- angular - EventEmitter 未捕获事件
- spring-boot - 如何加载 @ConditionalOnProperty 设置为 false 的类。?
- python - 在 python sklearn 中加载和使用 XGBoost PMML 或 XGBoost .rds 模型,而不会丢失其依赖项/性质
- c# - c# - 如何在流布局面板拖动中显示自定义用户控件,同时在c#中的Winform中使用移动图标鼠标光标?
- javascript - 如何在 ios 应用程序的 wkwebview 中的 amazon.in 的输入字段中自动填充信用卡/借记卡详细信息?
- java - 从图像中提取文本时分别突出显示文本
- html - html css表不会排列
- sql - 是否有一种智能的动态方法可以将拆分为多行的文本合并在一起?
- php - 使用 PHP 设置和获取全局环境变量
- sql - SQL 中有没有一种方法可以选择表中所有可用天数有 30 天的差异跳跃?