【问题标题】:How can I enable displaying website into the iframe?如何启用在 iframe 中显示网站?
【发布时间】:2017-01-31 07:20:04
【问题描述】:

我在将我的网站显示到框架中以显示点击地图时遇到了问题。错误是:“拒绝在框架中显示'https://balticland.ru/',因为它将'X-Frame-Options'设置为'SAMEORIGIN'。”但我对此没有任何禁忌。 Here is my .htaccess file.

我正在使用 Drupal。

你能给我一些建议吗?

【问题讨论】:

    标签: apache .htaccess iframe drupal web-deployment


    【解决方案1】:

    X-Frame_Options 是标头选项,它应该在任何输出开始之前与标头功能一起发送。比如:

    <?php header('X-Frame-Options: GOFORIT'); ?>
    

    Drupal 有特殊的设置 http 头的功能:

    https://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_add_http_header/7.x

    所以应该是这样的:

    drupal_add_http_header('X-Frame-Options', 'GOFORIT');
    

    查看以下功能描述的 cmets。

    更新:

    查看此文档:

    https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

    您可能必须指定外部来源,就像它所说的那样:

    X-Frame-Options: ALLOW-FROM https://example.com/
    

    【讨论】:

    • 您好!感谢您的回答!我已将此函数添加到 bootstrap.inc 的末尾。但是现在它仍然显示错误:“加载'balticland.ru'时遇到无效的'X-Frame-Options'标头:'GOFORIT'不是可识别的指令。标头将被忽略。”而这个 (mainspy.ru/otvet_servera) 测试仍然显示“X-Frame-Options: SAMEORIGIN header”
    猜你喜欢
    • 2015-08-30
    • 1970-01-01
    • 2019-04-09
    • 1970-01-01
    • 1970-01-01
    • 2011-10-15
    • 1970-01-01
    • 2017-04-10
    • 1970-01-01
    相关资源
    最近更新 更多