Я очень новичок в Facebook.
У меня очень простой вопрос. Как заставить FB.Event.subscribe
работать?
В моем тесте есть только поле , как , и мне нужно окно предупреждения, когда пользователь щелкает поле как .
Ниже мой код:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
<head>
<title>My Test</title>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '122001581243857', // App ID
channelURL : 'http://www.tagbeta.ca/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
oauth : true, // enable OAuth 2.0
xfbml : true // parse XFBML
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
//Code about the Like Box
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
//Code to response the click of the Like Box
FB.Event.subscribe('edge.create',
function() {
alert('Like box is clicked');
}
);
</script>
<div>
<fb:like-box href="http://www.facebook.com/platform" width="292" height="500" show_faces="true" border_color="red" stream="true" header="true"></fb:like-box>
</div>
</body>
</html>
Отображается поле , как , но при нажатии на него не выводится предупреждение.