javascript Facebook 分享对话框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9874612/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 08:07:02  来源:igfitidea点击:

Facebook Share Dialog

javascriptfacebookfacebook-javascript-sdk

提问by RGilkes

I am building a Facebook app and trying to implement a share dialog. Currently, I've only found how to create a feed dialog that allows you to post to your own wall (see image below).

我正在构建一个 Facebook 应用程序并尝试实现一个共享对话框。目前,我只找到了如何创建一个提要对话框,让您可以在自己的墙上发帖(见下图)。

current app post dialog http://perian.atlantafalcons.com/falcons_post.png

当前应用发布对话框 http://perian.atlantafalcons.com/falcons_post.png

What I am trying to achieve is a "Share" dialog that allows users to select whether they want to post to their own wall, on a friend's timeline, or a page. Spotify allows this functionality from their feed posts (see spotify example image below).

我想要实现的是一个“共享”对话框,它允许用户选择是要发布到自己的墙、朋友的时间线还是页面上。Spotify 允许从他们的提要帖子中使用此功能(请参阅下面的 Spotify 示例图片)。

spotify share dialog http://perian.atlantafalcons.com/spotify_share.png

spotify 共享对话框 http://perian.atlantafalcons.com/spotify_share.png

In addition to creating the share dialog, how do I add a "Share" action next to "Like" and "Comment" on a feed post?

除了创建共享对话框之外,如何在提要帖子的“喜欢”和“评论”旁边添加“共享”操作?

Thanks in advance!!

提前致谢!!

回答by Fisch

What you are looking for is the Share Button. Facebook has deprecated this and claim it will no longer be supported. If you want, you can still directly pop open a window with the content of the sharer by using a url similar to this:

您正在寻找的是Share Button。Facebook 已弃用此功能,并声称将不再支持此功能。如果您愿意,您仍然可以使用类似于以下内容的 url 直接弹出一个包含共享者内容的窗口:

https://www.facebook.com/sharer/sharer.php?u=http://google.com

https://www.facebook.com/sharer/sharer.php?u=http://google.com

and just change out the value of the uquery string parameter

只需更改u查询字符串参数的值