不会重定向到 ie 或 chrome 中的画布
我在粉丝页面上单击 chrome 中的应用程序选项卡时遇到问题,屏幕为空白,在 ie 中显示“此内容无法在框架中显示”,我尝试添加 header('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>
Im having problems in from fan page clicking on app tab in chrome the screen is blank and in ie it says "This content cannot be displayed in a frame" I tried adding header('P3P: CP="CAO PSA OUR"'); to my canvas with no luck. Any suggestions? Im really stuck here, thanks!
Here is code from my canvas
<?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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论