How to change the image thumbnail dynamically by using Facebook web SDK - javascript

Facebook development newbie.
I have added the meta tags to the html file which I want to share to Facebook.
like:
<meta property="og:type" content="article"/>
<meta property="og:title" content="title"/>
<meta property="og:description" content="description"/>
<meta property="fb:app_id" content="23232323323232"/>
<meta property="og:image" content="https://fajfladjfaljafl.jpg/>
I want to make the image thumbnail in Facebook profile different for different people. For example, people can do a small test here then share the result to Facebook, the image thumbnail should be the test result of that person. So how can I do this.
Now I am thinking to generate a new webpage within specific meta property for that person every time. But this's so dump!
Can I change <meta property="og:image" content="https://fajfladjfaljafl.jpg/> automatically when people share it to Facebook? or any other ideas?
Thank you very much!!
Hi everyone:
I am doing this via feed dialog. As what #Mosh Feu and #CBroe said, it doesn't make sense to change meta data.
I am using feed share link
https://www.facebook.com/dialog/feed?app_id=APP_ID&link=URL&picture=THUMBNAIL_URL&name=NAME&description=DESCRIPTION&caption=CAPTION&redirect_uri=REDIRECT_URI
to define the parameters every time.

Related

How do I integrate an embedded player into my website's metadata?

Currently, I'm using this to make a beautiful embed:
<meta name="description" content="Watch non-copyrighted media online.">
<meta name="keywords" content="bruh,dev,BruhDev,memes,meme,code,developer,software,engineer,coder,code,programmer,program,develop,develope,games,media,movies,tv,shows,movie,show,series,episode,season,seasons,episodes,netflix,hbo,hulu">
<meta name="theme-color" content="#FFA90A">
And this is how it looks like on Discord:
click here for image
But this is not enough, I want to embed an entire player into this, which you can see on
http://media.bruhdev.com/media/movies/watch/3, like on Youtube: click here for image
For the video, I use this HTML (view page source to see): http://media.bruhdev.com/media/movies/embed/3
How do I put this on the embed of my site?
*Don't mind the actual video, that's the thing about all my friends wanting their funny video's on here.
Thank you ahendwh2 for the answer, for anyone finding this post, here is an answer: https://stackoverflow.com/a/47112759/7409991

HTML5 - html, prefix and meta related

I am new to HTML5. I did some researches on prefix and OGP, but I still cannot figure out the following
<head prefix="og: http://ogp.me/ns#">
<title>something</title>
<meta property="og:title" content="something"/>
<meta prefix="og: http://ogp.me/ns#" property="og:image"
content="http://something.com/img/social-image.png" />
</head>
<head prefix="og: http://ogp.me/ns#">What's "og: http://ogp.me/ns#"? What does it do?
I found this from quora (https://www.quora.com/What-does-this-tag-mean-html-lang-en-US-prefix-og-http-ogp-me-ns), but I cannot understand it.
The Open Graph protocol enables any web page to become a rich object
in a social graph. For instance, this is used on Facebook to allow any
web page to have the same functionality as any other object on
Facebook.
What does "become a rich object" mean?
2.Why do we need these two lines, <title>something</title> and <meta property="og:title" content="something"/>? Aren't they same?
3.Why do we need to set the meta prefix again in the third line? Didn't we do it in the head?
<meta prefix="og: http://ogp.me/ns#" property="og:image"
content="http://something.com/img/social-image.png" />
Thanks a lot!
What you're describing is called Open Graph Protocol, and it essentially means you're using that template above to turn a webpage into a graph object. You need four parts: og:title, og:type, og:url, and og:image, which are described in detail here. This is the basic metadata you need to use Open Graph Protocol - if you don't have it, Open Graph won't work.

Twitter card not working even after validation

I want to add a Twitter button on my website to share content, as well as a Twitter card. I've already added the meta tags.
Here is the code for my share button:
Tweet
This is the code for the meta tags I've added as well:
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="#nytimes">
<meta name="twitter:creator" content="#SarahMaslinNir">
<meta name="twitter:title" content="When Great Minds Don’t Think Alike">
<meta name="twitter:description" content="How much does culture influence creative thinking?">
<meta name="twitter:image" content="http://176.32.230.11/trialandtest.com/assets/images/profile-img.jpg">
Here is the link to my site:
http://176.32.230.11/trialandtest.com/
I'd be grateful if someone could assist me as to where I am going wrong, because I have my URL whitelisted on Twitter, but when I try to share something it does not share the content on the preview window and shares the old one.
Your share url should be dynamic. I think when you click on the share button it is taking your static url ie. http://176.32.230.11/trialandtest.com

Can I share an HTML player?

I am trying to share a custom HTML/JavaScript player in Facebook. Is it possible?
I have tried with
<meta property="og:video" content="https://***/player.html">
<meta property="og:video:type" content="text/html">
<meta property="og:video:secure_url" content="https://***/player.html">
<meta property="og:video:width" content="500">
<meta property="og:video:height" content="500">
What I want to do is a system like the Twitter player cards. I wish to have my player embed in Facebook in an iframe (like Twitter). This way I can have a custom skin for my player and control it the way I want.
The code above is working if I link an MP3 file in secure_url & video but not when I link the player (example of link: https://***/player.html)
When shared on Facebook I have my link in a "video" element with the source set to my link.
well, youtube and soundcloud use html players for sharing. "https://www.youtube.com/embed/xPR-Ej-ENbk". So it should be possible, I am working on the same issue here, but when rendered on facebook am getting a div with class name "me-cannotplay", and am still trying to figure out if this something related to getting white listed by facebook or if there is something wrong with the html player i am using.
As #WizKid said, a simple answer is that you just cannot embed any javascript in facebook story.

How do you change what a like/send button posts to a facebook wall?

I'm working on a not for profit website, and trying to integrate with facebook. The app seems to work fine, single sign on works fine, even a custom "post to wall" function works fine using the javascript sdk. What does not work, however, is adding a photo to represent the entity, and anything other than default text, when a person clicks on the like button.
What's worse is there is some ghost text that I personally have never actually seen (other than in the text box itself) that finds its way into the dialog box when posting and leaving the text box empty.
The documentation here falls short:
https://developers.facebook.com/docs/reference/plugins/like/
Open Graph API tags also did nothing.
If you "like" the "like button" you'll see that their example does exactly what I'm trying to accomplish. There's a photo and a little description of what the button is. Is it possible to do this on other sites?
I've struggled a lot with this myself, but I found that by putting my page's URL into Facebook's debugger, it made the correct image, text, etc. show up when clicking a share button.
Add these tags in your pages' tags.
<html xmlns:og="http://ogp.me/ns#">
<head>
<meta property="og:title" content="insert your title here"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://www.example.com/foo/"/>
<meta property="og:image" content="http://www.example.com/images/example.jpg"/>
<meta property="og:site_name" content="A human-readable name for your site">
<meta property="og:description" content="A one to two sentence description of your page">
</head>
</html>
To turn your web pages into graph objects, you'll need to add Open Graph protocol tags and the Like button to your webpages.
Instructions are here:
http://developers.facebook.com/docs/opengraph/

Categories

Resources