Mic*_*ael 5 javascript facebook facebook-messenger
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)
再次,没有任何效果-如果有人有可以指出正确方向的线索,我将不胜感激..谢谢!
又看了一遍之后我就明白了。
if (response.is_after_optin == true ){ // do something }
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2952 次 |
最近记录: |