我的 Facebook 应用程序在 Firefox 中运行良好,但在 IE 中单击链接时表现奇怪:它一直重定向,当单击 iFrame 中的链接时,它最终重定向回 index.php,而不保留链接的 GET-Vars。它似乎总是重定向到 authentification-URL。
这是我的画布页面的核心部分:index.php:
<?
require 'facebook-php-sdk-6c82b3f/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'XXX',
'secret' => 'YYY',
));
function get_facebook_cookie($app_id, $application_secret) {
$args = array();
parse_str(trim($_COOKIE['fbs_' . $app_id], '"'), $args);
ksort($args);
$payload = '';
foreach ($args as $key => $value) {
if ($key != 'sig') {
$payload .= $key . '=' . $value;
}
}
if (md5($payload . $application_secret) != $args['sig']) {
return null;
}
return $args;
}
$cookie = get_facebook_cookie('XXX', 'YYY');
// Get User ID
$user = $facebook->getUser();
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
?>
<body onload="self.focus();document.tips.tip0A.focus()" scroll="no" style="overflow:hidden">
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function () {
FB.init({ appId: 'XXX', status: true, cookie: true, xfbml: true });
FB.Canvas.setSize({ height: 890 });
};
(function () {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
} ());
</script>
<?
if (!$user_profile[id]) {?>
<script>
var oauth_url = 'https://www.facebook.com/dialog/oauth/';
oauth_url += '?client_id=429812627032252';
oauth_url += '&redirect_uri=' + encodeURIComponent('https://apps.facebook.com/euro_challenge/');
oauth_url += '&scope=email,user_birthday'
window.top.location = oauth_url;
</script>
<?}?>
有任何想法吗?