为什么我无法在 Facebook 上分享我的网页链接?

发布于 2024-11-07 05:47:16 字数 1272 浏览 0 评论 0原文

该代码对我来说看起来不错,但我不知道为什么它不打开 FB 弹出窗口并共享我的网站。

这是 js 部分

function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){
          FB.ui(
          {
              method: 'stream.publish',
              message: '',
              attachment: {
                  name: name,
                  caption: '',
                  description: (description),
                  href: hrefLink
              },
              action_links: [
                  { text: hrefTitle, href: hrefLink }
              ],
              user_prompt_message: userPrompt
          },
          function(response) {

          });

      }
      function showStream(){
          FB.api('/me', function(response) {
              //console.log(response.id);
              streamPublish(response.name, 'Connect with Abhishek Raj Simon on his new website http://abhisheksimion.cjb.net', 'hrefTitle', 'http://abhisheksimion.cjb.net', "Share abhisheksimion.cjb.net");
          });
      }

html

<a id="fbanchor" href="#" onclick="showStream(); return false;">Like it, Share it!</a>

有人能指出,我哪里出了问题吗?您可以访问正在进行的工作网站 http://abhisheksimion.cjb.net

The code looks fine to me, but I have no clue why is it not bringing up the FB popup and sharing my site.

here is the js part

function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){
          FB.ui(
          {
              method: 'stream.publish',
              message: '',
              attachment: {
                  name: name,
                  caption: '',
                  description: (description),
                  href: hrefLink
              },
              action_links: [
                  { text: hrefTitle, href: hrefLink }
              ],
              user_prompt_message: userPrompt
          },
          function(response) {

          });

      }
      function showStream(){
          FB.api('/me', function(response) {
              //console.log(response.id);
              streamPublish(response.name, 'Connect with Abhishek Raj Simon on his new website http://abhisheksimion.cjb.net', 'hrefTitle', 'http://abhisheksimion.cjb.net', "Share abhisheksimion.cjb.net");
          });
      }

html

<a id="fbanchor" href="#" onclick="showStream(); return false;">Like it, Share it!</a>

Can somebody point out, where am i going wrong? You can visit the work in progress website http://abhisheksimion.cjb.net

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

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

发布评论

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

评论(1

像极了他 2024-11-14 05:47:16

我收到一个 JavaScript 错误:

错误:showStream 未定义
源文件:
http://users.cjb.net/abhisheksimion/
行数:1

我认为在您的脚本标记第 128 行中,右括号应该更高,以关闭 fqlQuery() 函数。如前所述,showStream()fqlQuery() 函数的一部分,这会导致 showStream() 失败。

如果您想做的只是添加基本的 Facebook 功能,例如“点赞”和“分享”,则无需使用大量 JavaScript 即可实现。

https://developers.facebook.com/docs/reference/plugins/like/

https://www.facebook.com/sharer/sharer.php?yoursite .com

其中“yoursite.com”是您要共享的网站。您可以使用 opengraph 标签来指定内容。

I get a javascript error:

Error: showStream is not defined
Source File:
http://users.cjb.net/abhisheksimion/
Line: 1

I think in your script tag, line 128, that closing bracket should be higher, to close off the fqlQuery() function. As written, showStream() is part of the fqlQuery() function, which causes showStream() to fail.

If all you are trying to do is add basic facebook functionality like "Like" and "Share" this can be achieved without using heavy javascript.

https://developers.facebook.com/docs/reference/plugins/like/

https://www.facebook.com/sharer/sharer.php?yoursite.com

Where 'yoursite.com' is the site you want to share. You can use opengraph tags to specify the content.

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