0

I have a single page app (using Vue.js) that shows videos and lets users share them on facebook. I am using the facebook javascript sdk for this, specifically the FB.ui() method create a share dialog.

FB.ui({
  method: 'share',
  href: 'https://myserver/mysite?video=1234',
});

This works but the facebook post is pretty boring. The link to the video is just the text of the url in a grey box. I'd like to be able to include a image, title, and description the way you by include <meta> tags inyour page as described here.

Of course, since this is a single page app, every video doesn't have its own page and set of <meta> tags so I was hoping the sdk would allow you to pass that info into the call to FB.ui(). I found a post with several different takes on how to use the method, but none of them worked for me. Some people indicated that facebook removed this functionality from the sdk.

Also, note that this site is served statically with no server side scripting allowed so we can't have script that outputs different <meta> tags based on what video is being requested.

Is this possible?

d512
  • 32,267
  • 28
  • 81
  • 107

1 Answers1

1

You cannot pass that information to the dialog anymore, you must use an URL with Open Graph Tags in the Source. JavaScript will be ignored.

You can solve this for SPAs with SSR (Server Side Rendering), for example. Take a look at https://prerender.io/ too.

andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • Sorry, I didn't do a good job explaining the set up. We are sharing links to site, not the video itself. Also the site is being served statically with no server side scripting allowed. I'll update the question with those points. – d512 Jun 17 '19 at 19:46
  • ok, it does not matter though, you HAVE to use static urls with html tags in the source for each video. i have updated my answer too. – andyrandy Jun 17 '19 at 20:01