DuchSuvaa
DuchSuvaa

Reputation: 676

Dynamically pass link to facebook share button

I literally searched the internet from top to bottom but I can't find the answer. Is it possible to dynamically pass links to facebook share button or dynamically create multiple share buttons, each on click? I was trying to achieve it with js, but I could only generate one button at time and couldn't change the link on it. Any suggestions, links to articles?

Upvotes: 0

Views: 844

Answers (1)

andyrandy
andyrandy

Reputation: 73984

You can use the Share Dialog to share dynamic links with JavaScript and the Facebook JavaScript SDK:

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

Source: https://developers.facebook.com/docs/sharing/reference/share-dialog/

Upvotes: 1

Related Questions