当按下发送按钮时捕获 FB.ui() 中的发送对话框信息

发布于 2024-12-01 01:11:43 字数 531 浏览 2 评论 0原文

Facebook 发送对话框的文档指出,'to' 参数可以包含用户 ID 或用户名。对话框出现后,用户还可以添加电子邮件地址。

有没有办法在启动时指定电子邮件地址(文档表明没有),或者是否有一个聪明的解决方法(也许通过 jQuery 进行 DOM 操作?)来插入电子邮件显示对话框后的地址?

编辑: 我已经能够将以下代码手动注入到对话框中“发送”按钮的 onclick 处理程序中:

var x=document.getElementById('feedform_user_message'); alert(x.value);

因此,现在当我单击“发送”时,警报窗口会正确显示消息文本!

后续步骤:

  1. 自动注入代码(也许是 jQuery?)
  2. 还捕获 To: 字段的内容,
  3. 调用 Web 服务来记录操作

The documentation for the Facebook Send Dialog states that the 'to' parameter can contain a user ID or username. Once the dialog comes up the user can also add email addresses.

Is there a way to specify an email address at startup time (documentation suggests no), or is there a clever workaround (DOM manipulation via jQuery maybe?) to insert an email address once the dialog is shown?

Edit:
I have been able to manually inject the following code into the onclick handler of the 'Send' button in the dialog:

var x=document.getElementById('feedform_user_message'); alert(x.value);

So now when I click 'Send', the alert window correctly shows me the message text!

Next steps:

  1. inject the code automatically (jQuery maybe?)
  2. also capture the contents of the To: field
  3. call web service to record the action

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

比忠 2024-12-08 01:11:43

以下是独立向许多用户发送 Facebook 私人消息的脚本。它对我有用。

    <html xmlns:fb="http://www.facebook.com/2008/fbml">

    <body>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <div id="fb-root"></div>
    <script>
    FB.init({appId: '[YOUR APPID HERE]', xfbml: true, cookie: true});
    </script>

    <a href="#" onclick="    
    FB.ui({
    method: 'send',
    name: 'Send Private Message',
    to: '[USERNAME1]'
    });
    ">Send Message to [USERNAME1]</a> 

    <a href="#" onclick="    
    FB.ui({        
    method: 'send',
    name: 'Send Private Message',
    to: '[USERNAME2]'
    });
    ">Send Message to [USERNAME2]</a> 


    <a href="#" onclick="    
    FB.ui({
    method: 'send',
    name: 'Send Private Message',
    to: '[USERNAME3]'
    });
    ">Send Message to [USERNAME3]</a> 


    </body>
    </html>

The following is a script to send Facebook private messages into many users independently. It works with me.

    <html xmlns:fb="http://www.facebook.com/2008/fbml">

    <body>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <div id="fb-root"></div>
    <script>
    FB.init({appId: '[YOUR APPID HERE]', xfbml: true, cookie: true});
    </script>

    <a href="#" onclick="    
    FB.ui({
    method: 'send',
    name: 'Send Private Message',
    to: '[USERNAME1]'
    });
    ">Send Message to [USERNAME1]</a> 

    <a href="#" onclick="    
    FB.ui({        
    method: 'send',
    name: 'Send Private Message',
    to: '[USERNAME2]'
    });
    ">Send Message to [USERNAME2]</a> 


    <a href="#" onclick="    
    FB.ui({
    method: 'send',
    name: 'Send Private Message',
    to: '[USERNAME3]'
    });
    ">Send Message to [USERNAME3]</a> 


    </body>
    </html>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文