I am using the PHP PHP SDK (2.1.2). All I want to do is what almost every Facebook application has with req_perms. The stupid "permission request" checkbox appears when it is installed.
I do not need a button that the user must click. I do not want to pop up. I do not want to use FBML since they eliminate it .
This is a standard Facebook permissions dialog that shows where my application should appear in a canvas iframe.
I tried:
<?php if(!$me): ?>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; <?php echo $loginUrl; ?>">
</head>
<?php die(); ?>
<?php endif; ?>
This for some reason showed the Facebook logo associated with the correct URL that I wanted (not what I want!)
<?php if($me): ?>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $appid; ?>',
session : <?php echo isset($session) ? "'".json_encode($session)."'" : 'null'; ?>,
status : true,
cookie : true,
xfbml : true
});
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<fb:redirect url="<?php echo $loginUrl; ?>" />
<?php die("</html>"); ?>
There was a blank page on this page.
<?php if($me): ?>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $appid; ?>',
session : <?php echo isset($session) ? "'".json_encode($session)."'" : 'null'; ?>,
status : true,
cookie : true,
xfbml : true
});
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<script>
FB.login(function(response) {
if (response.session) {
if (response.perms.indexOf('publish_stream') != -1) {
);
else {
}
}
else {
}, {perms:'offline_access,publish_stream'});
</script>
A blank page is also displayed here.
, , , Facebook - , - . . -, , .
:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $appid; ?>',
session : <?php echo isset($session) ? "'".json_encode($session)."'" : 'null'; ?>,
status : true,
cookie : true,
xfbml : true
});
FB.getLoginStatus(function(response) {
if (response.session) {
} else {
window.top.location = "<?php echo $loginUrl; ?>";
}
});
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>