dosf40815 2010-07-02 00:46 采纳率: 100%
浏览 119
已采纳

iframe重定向错误

I have a facebook iframe application that is having trouble redirecting, I keep getting security certificate errors like these "Content was blocked because it was not signed by a valid security certificate.", here is the redirect code,

$params = array(
    'canvas'=>1,
    'fbconnect'=>0,
    'req_perms'=>'user_photos,publish_stream,offline_access',
    'next'=>'http://apps.facebook.com/my-test/', 
    'cancel_url'=>'http://apps.facebook.com/my-test/',
);

$redirect = $facebook->getLoginUrl($params);

echo "<script language='Javascript' type='text/javascript'>top.location.href='$redirect';</script>";

and when I try to redirect the user using a PHP redirect, like so,

header('Location: '.$redirect);

all I get is a iframe filled with a black background.

Is there another way I could redirect the page? or fix this error?

Thanx in advance!

  • 写回答

1条回答 默认 最新

  • duanbinmi8970 2010-07-02 00:50
    关注

    Make sure your not sending whitespace in your scripts before the header command.

    An example of whitespace

    <?php
    echo ' ';
    
    header('Location: home'); //Will not send.
    ?>
    

    Another example:

         <-- Whitespace here maybe?
    <?php
        header('Location: home'); //Will not send.
    ?>
    

    Try turn on php errors to debug whats going on when you send the header command, using error_reporting(E_ALL);

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部