[英]Show alert on a button click
I'm using the default Facebook embed code: 我正在使用默认的Facebook嵌入代码:
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#appId=176702405718664&xfbml=1"> </script>
<fb:like href="http://domain.com" send="true" width="700" show_faces="false" action="recommend" font=""></fb:like>
.. but I'd like to show an alert if the user clicks 'recommend' or 'send' buttons. ..但是如果用户点击“推荐”或“发送”按钮,我想显示提醒。 Please see this fiddle:
请看这个小提琴:
http://jsfiddle.net/4wB9x/1/ http://jsfiddle.net/4wB9x/1/
Thanks! 谢谢!
you will have to subscribe to the edge.create event, it gets triggered when user clicks the like button. 您必须订阅edge.create事件,当用户单击like按钮时会触发它。
FB.Event.subscribe('edge.create',
function(response) {
alert('You liked the URL: ' + response);
}
);
// for send you will have to use this //发送你必须使用它
FB.Event.subscribe('message.send',
function(response) {
alert('You sent the URL: ' + response);
}
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.