【问题标题】:Error on try insert a embed of Gist (GitHub) with PHP尝试使用 PHP 插入 Gist (GitHub) 嵌入时出错
【发布时间】:2015-07-13 09:34:10
【问题描述】:

我正在尝试使用 PHP 插入 Gist 的嵌入,如下所示:

<?php
    echo "<script src='https://gist.github.com/schacon/4277.js'></script>";
?>

但是,查看控制台,返回如下错误:

在“文档”上执行“写入”失败:无法写入 从异步加载的外部脚本到文档中,除非 它是显式打开的。

我也试过了:

echo "<iframe src='https://gist.github.com/schacon/4277.js'></iframe>";

和:

echo "<embed src='https://gist.github.com/schacon/4277.js'></embed>";

但是两者都返回了:

拒绝在 a 中显示“https://gist.github.com/schacon/4277.js” 框架,因为它将“X-Frame-Options”设置为“拒绝”。

我该如何向他展示要点?还是不是这样?

对不起,我的英语不好。

【问题讨论】:

    标签: php github embed gist


    【解决方案1】:

    如果您正在访问的页面将header X-Frame-Options 设置为deny,则您无法在i-frame 中访问它们。

    该页面无法在框架中显示,无论网站是否尝试这样做。

    Check Here

    【讨论】:

      猜你喜欢
      • 2020-10-13
      • 2021-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多