简体   繁体   English

Facebook JavaScript SDK共享对话框无法在移动设备上运行

[英]Facebook JavaScript SDK share dialog not working on mobile

Im using the FB JavaScript SDK to share some content on my website. 我正在使用FB JavaScript SDK在我的网站上共享一些内容。 This is the code: 这是代码:

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) {

}

}); }); } }

I can share the article on the desktop version. 我可以在台式机版上共享该文章。 If I click on the shared element on FB it redirects to the article I want to. 如果单击FB上的共享元素,它将重定向到我想要的文章。

The problem is that it doesnt work on mobile devices. 问题是它在移动设备上不起作用。 When I click on my share button the Facebook app opens and if I tap on share, the link will get broken. 当我单击共享按钮时,Facebook应用程序将打开,如果我单击共享,则链接将断开。 The parameter 'id' is no longer there, What can I do to solve this? 参数“ id”不再存在,该怎么办?

I was adding some extra info on the url that was breaking the link. 我在断开链接的URL上添加了一些额外的信息。 This is the final code: 这是最终代码:

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) {

}

It works on Android and iOs. 它适用于Android和iOs。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM