无法加载所有iframe

时间:2013-01-30 08:21:53

标签: php jquery

我无法加载iframe中的所有网站,例如youtube,facebook和twitter。 我从我的数据库加载所有页面,其他网站加载正常。

我试过了:

JS:

function showeffect(sUrl,sName)
    {

        $('#effect').hide(1000);
        $('#effect').show(2200);
        $('#website').attr("src", sUrl);

    }

PHP:

        <?php 


            $sql = "SELECT naam, url FROM items";
            $database = new PDO('mysql:host=localhost;dbname=startandhome','root','');
            $results = $database->query($sql); 

            $contentregel = 'contentregelblauw';
            foreach($results as $row) 
            { 

                $itemnaam = $row['naam'];
                $itemUrl = $row['url'];

                echo "<div class=\"" .$contentregel ."\"><a href=\"#\" onclick=\"showeffect('".$itemUrl ."','".$itemnaam ."'); return false;\">" .$itemnaam ."</a></div>";

                if ($contentregel == 'contentregelgrijs')
                {
                    $contentregel = 'contentregelblauw';
                }
                else
                {
                    $contentregel = 'contentregelgrijs';
                }
            }


        ?>

HTML:

<iframe id="website" class="website" src=""></iframe>

1 个答案:

答案 0 :(得分:1)

这是因为facebook限制在其他域框架中托管页面。 通过附加X-Frame-Options标题来完成。 X-frame-options

  1. Facebook和Twitter网站有x-frame-options,这意味着他们不允许跨域调用。他们通过x-frame-options限制。
相关问题