i’m currently building an app where you can like the app itself from a like button inside the frame. So, i load the js sdk :
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $appid; ?>', // App ID
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
FB.Canvas.setSize()
checkIfLoaded();
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
then i just write a like button in the html :
<div id="page" class="page-01">
<div id="content">
<h1><a href="#"><img src="img/skin/logo.png" alt=""/></a></h1>
<div class="block-01">
<div id="fb-root"></div>
<div class="fb-like" data-send="false" data-layout="button_count" data-width="105" data-show-faces="false"></div>
</div>
</div>
<div id="footer">
</div>
</div>
I was expecting a like on my application by this button, but it like the url hosting my application.
I’m new to js sdk, is there a way to do this kind of things ?
There is no such thing as “Liking Application”, actually the only thing you can bound your Like Button is URL (which may represent OpenGraph object).
You cannot use Like Button to like any internal Facebook Objects like Page, Application, User, etc.
If you speaking about liking the Page that associated with specific Application you should use Like Box social plugin (which is intended to be used with Pages).