允许允许PHP中的跨源框架

时间:2015-10-21 05:41:49

标签: php html iframe x-frame-options

我有以下观点

Page on honor.es showing the error

查看sample page

点击打开弹出式编辑器后,我没有得到结果,它显示它仍在加载但从未结束。

然后我使用Firebug检查了这个,我看到了以下错误:

  

X-Frame-Options拒绝加载:https://www.picozu.com/editor/?i=aHR0cDovL2FiLWZseWVycy5ob25vci5lcy9EZXNlcnQuanBn&key=A7lwl9MYGLNfVL7x&theme=galaxy&workspace=2不允许跨源框架。

以下是错误的屏幕截图:

Cross-origin error shown in Firebug's console

我尝试通过将HTML页面转换为PHP脚本并添加以下代码来解决此问题:

<?php header('Access-Control-Allow-Origin: *'); ?>

所以这就是那个PHP文件

<!DOCTYPE html>
<html>
  <head>
    <?php header('Access-Control-Allow-Origin: *'); ?>
    <meta name="viewport" content="width=device-width" />
    <title>Brochure_Dashboard</title>

    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.classypicozu.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/jquery.classypicozu.min.css" />
  </head>
  <body>
    <div> 
      <button class="picozu">Open Popup Editor</button>
      <script type="text/javascript">                                    
      $('.picozu').ClassyPicozu({
        key: 'A7lwl9MYGLNfVL7x',
        image: 'http://ab-flyers.honor.es/Desert.jpg',
        width: 900,
        height: 600,
        theme: 'galaxy',
        workspace: 2
      });
      </script>
    </div>
  </body>
</html>

但错误仍然是一样的。你可以try it out yourself

我只是想知道,我的PHP文件有什么问题或者如何更正此错误?

1 个答案:

答案 0 :(得分:0)

在这种情况下,我担心你无法做任何事情,因为X-Frame-Options:SAMEORIGIN是在你所包含的iframe的网络服务器上设置的。它限制任何网站将其内容交叉来源。

同源策略是浏览器核心的配置,实现它的唯一方法是修改浏览器的核心功能。

此致