Ad

Facebook JavaScript SDK Share Dialog Not Working On Mobile

Im using the FB JavaScript SDK to share some content on my website. 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.

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. The parameter 'id' is no longer there, What can I do to solve this?

Ad

Answer

I was adding some extra info on the url that was breaking the link. 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.

Ad
source: stackoverflow.com
Ad