window.fbAsyncInit = function() {
FB.init({
appId : '********', // App ID
channelUrl : document.location.protocol + '//connect.facebook.net/en_US/all.js', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
var fql_query = "SELECT uid FROM page_fan WHERE page_id = "+page_id+"and uid="+user_id;
FB.Data.query(fql_query).wait(function(rows) {
if (rows.length == 1 && rows[0].uid == user_id) {
console.log("LIKE");
$('#container_like').show();
} else {
console.log("NO LIKEY");
$('#container_notlike').show();
} }
just i need to check user like Facebook page or not with out request any access token or permission is that possible ???
I dont think it's possible if I'm understanding you correctly... ultimately youre always going to need the user to authorize your app and get an auth token in order to know the user's id. FB doesnt let you know user's uid without their permission
yes , i possible i did that by php with following code with out request and permission from user
require 'src/facebook.php';
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook( array(
'appId' => '***************',
'secret' => '**********************',
'cookie' => true,
) );
$signed_request = $facebook->getSignedRequest();
// Return you the Page like status
$like_status = $signed_request[ "page" ][ "liked" ];
if ( $like_status ) {?>
<div class="facebook-data-content" id="facebook-data-content"> </div>
<?php } else {
?>
<div class="like-gate" id="like-gate"> </div>
<?php } ?>
and you can do the same with JavaScript note : all need check that redirect URL correct first before do anything because most problem about this issues
good luck :)
来源:https://stackoverflow.com/questions/19163343/ckeck-if-user-like-facebook-page-or-not-without-request-access-token