Facebook JavaScript SDK共享对话框在移动设备上不起作用

Facebook JavaScript SDK share dialog not working on mobile

本文关键字:不起作用 移动 JavaScript SDK 共享 对话框 Facebook      更新时间:2023-09-26

我使用FB JavaScript SDK在我的网站上共享一些内容。这是代码:

function feedShare() {
FB.ui({
    method: 'share',
    href: 'http://www.domaintoshare.com/index.html?&target=_top&output=embed&id=' + article.id,
    picture: article.picture,
    name: 'article.name',
    description: 'article.description'
}, function(response) {
}

});}

我可以在桌面版上分享这篇文章。如果我点击FB上的共享元素,它会重定向到我想要的文章。

问题是它在移动设备上不起作用。当我点击我的共享按钮时,Facebook应用程序就会打开,如果我点击共享,链接就会断开。参数"id"已不存在,我该怎么办才能解决此问题?

我在破坏链接的url上添加了一些额外的信息。这是最后一个代码:

FB.ui({
    method      : 'share',
    href        : 'http://www.domaintoshare.com/index.html?id=' + article.id,
    picture     : article.picture,
    title       : article.name,
    description : article.description
}, function(response) {
}

它适用于Android和iOs。