How do I properly test share functionality using Facebook's web hosting? - javascript

I am developing an HTML5 game for the Facebook platform. I am using Facebook's Web Hosting product to host the game and I have created a test version of the app to see if it works properly on Facebook.
Despite having added the open graph meta tags to the games HTML code, when I test the game and try to share it using the share dialog, all the information in the meta tags is ignored. The title, the description, the image, none of them are used.
I have used Facebook's share debugger, but it claims none of the meta tags are set. The documentation is not really helpful in this specific case.
These are my open graph tags:
<meta property="og:url" content="http://apps.facebook.com/kanji-climber/" />
<meta property="og:title" content="Kanji Climber" />
<meta property="og:description" content="Test your kanji knowledge! How high can you climb?" />
<meta property="og:type" content="game">
<meta property="fb:app_id" content="172026516880138" />
This is the function call I use for sharing:
FB.ui({
method: 'share',
href: 'https://apps.facebook.com/kanjiclimber',
}, function(response){});
Am I missing something?

Related

og:url ignored in SPA when redirected to a route handling the rendering of required meta tags

I'm trying to implement social share buttons in my SPA that's served over Azure CDN.
In order overcome the problem of bots not executing javascript on my page I'm redirecting these (via 302) to my express.js backend where I'm rendering and returning valid HTML with all the required og: META tags populated, all works just fine.
<head>
<meta property="og:title" content="${story?.headline}" />
<meta property="og:description" content="${introText}" />
<meta property="og:image" content="https://backend-example.com/${imageUrl}" />
<meta property="og:url" content="https://www.example.com/story/${story?.id}" />
</head>
The problem is, the og:url tag is ignored in the thumbnail rendered by social networds, and istead of:
"https://www.example.com/story/11"
it shows the URL of my backend:
"https://www.backend-example.com/story/11"
I'm wondering if there's a possible workaround for this so the thumbnail will show the SPA's URL instead of the backends?
Best,
vedtam

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

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

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.

Inject text dynamically to facebook's share dialog via content-script - javascript

my app is a chrome extension
I have a content-script injected to Facebook share pop-up.
I successfully manage to add text to the input via DOM manipulation,
but when I click share, it clears the input and then share the link.. any idea why?
Best practice for FB share is via Open Graph, http://ogp.me/
<!-- Facebook Open Graph Meta Tags -->
<meta property="og:title" content="OG title" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://domain.com" />
<meta property="og:image" content="http://domain.com/fb-image.png" />
<meta property="og:description" content="OG description" />
You can also try FB sharer, but keep in mind that it's deprecated and not advised to use.
fb share

Categories

Resources