小编Mic*_*ael的帖子

Facebook发送给信使事件监听器

Facebook推出了非常酷的功能,我一直在尝试找出如何在用户单击并选择加入后使页面重定向。现在,我对Java毫无用处,php是我的事。

参考:https : //developers.facebook.com/docs/messenger-platform/plugin-reference/send-to-messenger#event

工作代码:

FB.Event.subscribe('send_to_messenger', function(e) {
// callback for events triggered by the plugin
console.log('inside the send_to_messenger');  
window.top.location = 'http://google.com';
});
Run Code Online (Sandbox Code Playgroud)

这将启动console.log并重定向,但是我想做的是当用户单击按钮并使用send_to_messener按钮触发选择加入时执行某些操作。

所以我尝试了

FB.Event.subscribe('clicked', function(e) {
// callback for events triggered by the plugin
console.log('user clicked button');  
window.top.location = 'http://google.com';
});
Run Code Online (Sandbox Code Playgroud)

-也-

FB.Event.subscribe('send_to_messenger', function(e) {
FB.Event.subscribe('clicked', function(e) {
// callback for events triggered by the plugin
console.log('user clicked button');  
window.top.location = 'http://google.com';
}});
Run Code Online (Sandbox Code Playgroud)

再次,没有任何效果-如果有人有可以指出正确方向的线索,我将不胜感激..谢谢!

javascript facebook facebook-messenger

5
推荐指数
1
解决办法
2952
查看次数

标签 统计

facebook ×1

facebook-messenger ×1

javascript ×1