不会重定向到ie或chrome中的画布

时间:2011-10-25 17:59:21

标签: facebook redirect tabs facebook-canvas

我从粉丝页面点击Chrome中的应用程序选项卡时出现问题,屏幕显示为空白,即显示“此内容无法显示在框架中”我尝试添加标题('P3P:CP =“CAO PSA OUR” “);我的画布没有运气。有什么建议?我真的卡在这里,谢谢! 这是我画布上的代码

<?php 

$app_id = "181247898619054";
$app_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$my_url = "https://apps.facebook.com/wellnessiq/";
session_register();
session_start();
header('P3P: CP="CAO PSA OUR"');

if (!isset($_REQUEST["code"]))
{
 $_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection
 $dialog_url = "https://www.facebook.com/dialog/oauth?client_id=" 
   . $app_id . "&redirect_uri=" . urlencode($my_url) . "&scope=email&state="
   . $_SESSION['state'];

 echo("<script> top.location.href='" . $dialog_url . "'</script>");
exit;
}
 $code = $_REQUEST['code'];
 {
  $token_url = "https://graph.facebook.com/oauth/access_token?"
   . "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url)
   . "&client_secret=" . $app_secret . "&code=" . $code;

 $response = file_get_contents($token_url);
 $params = null;
  parse_str($response, $params);

  $graph_url = "https://graph.facebook.com/me?access_token=" 
   . $params['access_token'];

  $user = json_decode(file_get_contents($graph_url));
}

?>
<script type="text/javascript">
function detailsHandler(href) {
var name = document.plz.name.value;
//get any other hidden fields and append them.
href = href + name;
//then redirect to the revised url
window.location = href;
}
function get_radio_value()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
for (var i=0; i < document.plz.myGuess.length; i++)
{
if (document.plz.myGuess[i].checked)
  {
  var rad_val = document.plz.myGuess[i].value;
var rightAnswer = document.plz.here.value;
}}
if (Number(rad_val) == Number(rightAnswer))
    {var points=1;}
else { 
var points=0;}

xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4)
{
document.getElementById('ears').innerHTML=xmlhttp.responseText;
document.getElementById('hide').style.visibility = 'hidden'; 
document.getElementById('try').style.visibility = 'visible'; 
}
}
var entryID = document.plz.entryid.value;
var name = document.plz.name.value;
var email = document.plz.email.value;

xmlhttp.open("GET","/script/facebook/fb_question.php?correct=" + points + "&entryid=" +     entryID + "&name=" + name + "&email=" + email,true);

xmlhttp.send();  

}

</script>

0 个答案:

没有答案