I used the facebook after liked redirection code like this . but I cant find a solution for user already liked. if user already liked redirect page.
the code is
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: 'xxxxxxxxxxxxxxxxx',
status: true,
cookie: true,
xfbml: true
});
FB.Canvas.setSize({ width: 400, height: 80 });
FB.Event.subscribe('edge.create',
function(response)
{
alert('Thank You');
// put redirect code here eg
window.location = "http://www.example.com/FacebookAutoRedirect.asp";
}
);
**if also liked
{
window.location = "http://www.example.com/FacebookAutoRedirect.asp";
}**
};
//Load the SDK asynchronously
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/tr_TR/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
best regards
That´s only possible if you authorize the user (you need a Facebook app for that), with the "user_likes" permission > After that you can read his likes and check if he liked a specific page.
Facebook docs about user login: https://developers.facebook.com/docs/reference/javascript/FB.login/
Careful with that, you cannot just open it without any user interaction:
Calling FB.login results in the JS SDK attempting to open a popup window. As such, this method should only be called after a user click event, otherwise the popup window will be blocked by most browsers.
Or with the PHP SDK: https://developers.facebook.com/docs/reference/php/facebook-getLoginUrl/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.