如何在没有SDK或自定义应用程序ID的情况下创建Facebook分享按钮? [英] How create a Facebook share button without SDK or custom app id?

查看:120
本文介绍了如何在没有SDK或自定义应用程序ID的情况下创建Facebook分享按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看 Facebook共享按钮的最新更新. 似乎不再可能在不包含Facebook javascript SDK的情况下在网站中包含共享按钮,或者在某个地方为您提供应用程序ID的Facebook应用程序了?

I am looking at the latest update to Facebook's share button. It seems that it's no longer possible to include a share button in a website without including the Facebook javascript SDK, or having a Facebook app somewhere that provides you with an app id?

共享"按钮示例1使用Facebook SDK

Share button example 1 uses the Facebook SDK

FB.ui({
  method: 'share',
  href: 'https://developers.facebook.com/docs/',
}, function(response){});

共享"按钮示例2使用自定义应用程序ID

Share button example 2 uses a custom app id

https://www.facebook.com/dialog/share?
  app_id=145634995501895
  &display=popup
  &href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2F
  &redirect_uri=https%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fexplorer

问题:如何用一行代码为Facebook构建简单明了的共享按钮,而无需库和应用程序ID?

Question: how to build a plain and simple share button for Facebook with one line of code, that does not require libraries and app id's?

推荐答案

您可以使用facebook sharer链接和一个简单的弹出窗口来完成工作

you can use facebook sharer link and a simple popup to do the job

$("#facebookShareLink").on("click",function(){
    var fbpopup = window.open("https://www.facebook.com/sharer/sharer.php?u=http://stackoverflow.com", "pop", "width=600, height=400, scrollbars=no");
    return false;
});

这篇关于如何在没有SDK或自定义应用程序ID的情况下创建Facebook分享按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆