不使用appId在Facebook上共享URL

Share URL on Facebook without using appId?

本文关键字:共享 URL Facebook appId      更新时间:2023-09-26

我想在不创建Facebook应用程序的情况下在Facebook上共享URL,还可以检测是否按下了"共享">按钮。这是我的代码:

<input type="button" onclick="share_prompt()" value="Share" />
<script src="http://connect.facebook.net/en_US/all.js" type="text/javascript" charset="utf-8"></script>
<div id="fb-root"></div>    
<script type="text/javascript" charset="utf-8">
FB.init({
    appId: 'YOUR_APP_ID', 
    status: true, 
    cookie: true,
    xfbml: true
});
function share_prompt()
{

    FB.ui(
  {
    method: 'share',
    href: 'http://www.mywebsite.com',
  },
  function(response) {
    if (response && !response.error_code) {
      alert('Posting completed.');
    } else {
      alert('Error while posting.');
    }
  }
);
 }
</script>

使用我的代码,共享弹出窗口显示

"参数app_id是必需的">

我该怎么做?有可能吗?提前感谢:D

您可以使用sharer.php,只需点击鼠标打开一个弹出窗口:

https://www.facebook.com/sharer.php?u=[encoded-url]

没有应用程序,你就无法使用FB.ui(或一般的FB(。