I am using the following script to share links with Facebook:
<script>function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script>Share on Facebook
When facebook share screen popup opens it displayes title and description. I want to provide my own title and description of share are there parameters available for this?
Create a Facebook Application at http://developers.facebook.com/
Then embed Open Graph metatags in your document that describe to the Facebook document linter which title, image, description, and URL to use when shared.
Open Graph Documentation
Open Graph Debugger
Here is an example copied from the Facebook documentation that shows the Open Graph meta tags used to describe a website.
<html>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#
website: http://ogp.me/ns/website#">
<meta property="fb:app_id" content="YOUR_APP_ID">
<meta property="og:type" content="website">
<meta property="og:url" content="URL of this object">
<meta property="og:image" content="URL to an image">
<meta property="og:title" content="Name of blog">
<meta property="og:description" content="Description of object">
</head>
<body>
<!--a wonderful website -->
</body>
</html>
See http://developers.facebook.com/docs/share/ for more detailed view of the Facebook Share.
I think you can change the t= parameter to change the title of your share post on Facebook, not sure if you can change the description, I think the description comes from the meta Description of the page you are sharing.
Related
How facebook identify the entered hyperlink and get data from that link. it shows thumbnails, text, pictures, etc. Does facebook using any javascript for framework?
Open graph protocol (OGP) is what helps Facebook get specific data from URL i.e. Web page title, site name, description ... etc
To install OGP on your site (page)
Add: prefix="og: http://ogp.me/ns#" into <html> tag
And:
<meta property="og:title" content="{Title}" />
<meta property="og:type" content="{site_type}" />
<meta property="og:url" content="{page_URL}" />
<meta property="og:image" content="{Thumbnail}" />
between <head> tags.
Those above are basic meta properties You can read more about it on OGP
When I click on the link button on my website , I get the notification on Facebook that I have liked such and such thing and along with that my Logo of the website Appears. However I want that the logo of the website is not shown but instead the Image of the product is shown.
I am using the step 1 like button on this URL https://developers.facebook.com/docs/reference/plugins/like/
You need to look at open graph meta tags and in particular the image tag. og:image.
A full example of tags and how they work can be found here http://developers.facebook.com/docs/opengraphprotocol/ but the general jist of what you need is:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>My Movie Website</title>
<meta property="og:title" content="My Movie Website"/>
<meta property="og:type" content="movie"/>
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
<meta property="og:image" content="http://mymovies.com/images/logo.png"/>
<meta property="og:site_name" content="My Movies"/>
<meta property="fb:admins" content="USER_ID"/>
<meta property="og:description"
content="Some content description blah..."/>
...
</head>
...
</html>
By setting this tag it should tell Facebook the image to load. You can test this via Facebooks tools online here http://developers.facebook.com/tools/debug
I am using mediawiki 1.19 and I've added facebook 'like'. When I click like the image posted is the site logo. How do I take the image from the page. I've run the site through http://developers.facebook.com/tools/debug and it seems og:image is set to the site logo. How do I change this meta property?
My site is thepetwiki.com
Thanks
You are going to gave to add some custom og:tags to the HTML markup of your page and specify the image that you want to use...
Take a look at the example from the Facebook documentation -
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock"/>
<meta property="og:type" content="movie"/>
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
<meta property="og:site_name" content="IMDb"/>
<meta property="fb:admins" content="USER_ID"/>
<meta property="og:description"
content="A group of U.S. Marines, under command of
a renegade general, take over Alcatraz and
threaten San Francisco Bay with biological
weapons."/>
...
</head>
...
</html>
As you can see the og:image parameter is specified here and that allows Facebook to correctly display the meta data associated with that URL...
You might not need all of the og:tags specified here, title,url,image and description should be fine for just a LIKE button.
You are already aware of the debugger tool - it will help you debug your LIKE button and og:tags. Make some changes in your HTML markup and each time you'll have to send your URL though the debugger to refresh Facebook's cached version of your URL.
A quick Google search gave me this mediawiki extension that looks like it could help you -
http://www.mediawiki.org/wiki/Extension:OpenGraphMeta
OpenGraphMeta provides OpenGraph protocol metadata for articles on the wiki for 3rd parties like Facebook to extract...
see post http://www.mediawiki.org/wiki/Extension_talk:Facebook#OpenGraph_image_problems.
The open graph coding is all part of the Facebook extension.
i am having some tweets like things and i would like to post that custom text with facebook like button. is it possible if yes then how.
thanks
Use Open Graph Tags:
Put this tags on your page head section:
<html xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta property="og:image" content="custom image path" />
<meta property="og:site_name" content="name of the website" />
<meta property="og:title" content="custom title" />
<meta property="og:url" content="url of the page" />
<meta property="og:description" content="custom description" />
<meta property="og:type" content="website/article/game etc.." />
</head>
use Linter to check your custom properties has affected.
More about Opengraph tags
You should add OpenGraph meta tags to the page located on URL you linking your like button. Once user click on Like Button Facebook crawl that page and post content of OG tags to feed.
Read more on Like Button documentation and Open Graph protocol
Although it is true as both the other commenters say you would need to create a facebook app which then would require a secure canvas URL in the end to be verified. Hence the obstacle is quite high.
I'm building a facebook iFrame application that uses facebook comments. When a user leaves a comment the default action is that this comment will be posted to their wall. The wall post is something along the lines of
UserX commented on example.com
# the comment text goes here
http://example.com
apps.facebook.com
You should be able to include an image, a description, and set the link to be the title of the page (where it says http://example.com above the apps.facebook.com), but I'm having no luck getting this to work.
I thought it would grab the information from my meta tags (as long as they included the appropriate 'og' tags), but that isn't working. Nor am I able to define values for title, url, image etc. in the same way that you can for normal wall posts.
Anyone have any idea how to get this working??
EDIT:
Here are the meta tags I currently am using.
<meta property="og:title" content="USERNAME'S PAGE" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://example.com"/>
<meta property="og:image" content="http://example.com/images/wall-post.png" />
<meta property="og:description" content="Some description goes here." />
Use URL Linter to Debug
http://developers.facebook.com/tools/lint/
Make sure all meta tags are correct and if you've made some changes, it takes some time to update for facebook and here's a sample, this is a working version:
<!doctype html>
<html xmlns:og="http://ogp.me/ns#"
xmlns:fb="https://www.facebook.com/2008/fbml" lang="en">
<head>
<meta charset="utf-8">
<title>Facebook Comment Box Sample</title>
<meta property="og:title" content="YOUR-POST-TITLE"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="http://YOUR-SITE-URL"/>
<meta property="og:image" content="http://YOUR-IMAGE-URL"/>
<meta property="og:site_name" content="YOUR-SITE-TITLE"/>
<meta property="og:description" content="YOUR-DESCRIPTION"/>
<meta property="fb:admins" content="YOUR-USER-ID"/>
</head>
<body>
<h1>Facebook Comment Box:</h1>
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments href="http://YOUR-SITE-URL" num_posts="10" width="500"></fb:comments>
</body>
</html>
OK, after a lot of stumbling around I figured this out.
My iFrame application requires facebook authentication before accessing the application (as I believe all facebook apps do). This means that the facebook crawlers were unable to crawl my homepage and pick up the og: meta tags.
To solve this I first had to figure out what the facebook crawler looks like. I logged the HTTP_USER_AGENT for all requests and then used the facebook URL Linter (http://developers.facebook.com/tools/lint/) to ping my site.
The facebook crawler identifies itself as "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"
Once I had that I was able to just add a little conditional logic to let the crawler bypass authentication and access my site. I hope this helps others.
First I made sure I had all my meta properties set, then I just put my code in this:
if (strpos($_SERVER['HTTP_USER_AGENT'],"externalhit_uatext")<5)
{
}