Facebook Share doesn't pick up title / description meta tags that are changed after page load - facebook

Apparently Facebook Share doesn't pick up the title / description meta tags that are changed (via JavaScript) after the page load. It basically use the meta tags that are available upon load.
This is a simple example.
The link will change the title / description meta tags upon click. You can confirm that using Firebug.
Click the f|Share button: Facebook still always shows "A title that is available upon page load." and "A description that is available upon page load."
Anybody knows how to fix this?

This is a quote from Facebook. They scrape the page's meta tags when someone shares that page, and every 24 hours onwards (and not on page-load as you suggested). If you change the meta tags, you need to get FB to "lint" your page again using the URL Linter.
When does Facebook scrape my page?
Facebook needs to scrape your page to know how to display it around the site.
Facebook scrapes your page every 24 hours to ensure the properties are up to date. The page is also scraped when an admin for the Open Graph page clicks the Like button and when the URL is entered into the Facebook URL Linter. Facebook observes cache headers on your URLs - it will look at "Expires" and "Cache-Control" in order of preference. However, even if you specify a longer time, Facebook will scrape your page every 24 hours.
Source

Because the facebook server hits the URL you submit and looks for meta tags. It will always default to the original tags.

I assume that Facebook servers do not execute javascript when they scrape your page.
You could use server-side logic to detect the Facebook user agent and modify the outputted HTML accordingly.
According to the bottom of this page ( http://developers.facebook.com/docs/opengraph/ ), the user agent is currently:
facebookexternalhit/1.0

Its none of Facebook business. They just provide an api for it. And api takes meta tags as parameter. So you set your meta tags to facebook sharing.

Related

Why does FB sharer use only the OG meta tag details on the home page?

I have a project, coded on codeigniter, which is basically a collection of posts by different users. While adding the fb share button and clicking on it, The image, title and description content is taken from the header of the home page and not of the page(view) where the share button is placed?
As mentioned here, The issue was that only those users could view the page who are signed in, and therefore even fb wasn't able to scrape the info from there.
EDIT: Whats important here is how FB scrapes the info. Apparantly the link you provide inside data-href if parsed by FB and they capture the og meta tags from the header on that page. However if you restrict those pages to logged in users, FB is also unable to parse the page and thus it reverts to the base URL's meta tags.

Facebook share not using updated OG meta

I'm sharing posts on facebook and it's not using my updated OG and meta tags. How long does it take for the changes to make affect.
You can refresh the OG tags in the Facebook debugger: https://developers.facebook.com/tools/debug/
You can also take a look at this thread with the same question: Share Cache Timeout
Answer from the Like Button docs:
Why and when does Facebook scrape my page?
Facebook needs to scrape your page to know how to display it around
the site. This happens every 24 hours to ensure the properties are up
to date. The page is also scraped when the URL is entered into the
Debugger Tool.
Btw, there is a nice way to update many pages at once in this thread: Facebook Open Graph not clearing cache

Like Box ('Could not retrieve the specified page. Please verify correct href was passed in.')

I need some information, why like box frame not working: 'Could not retrieve the specified page. Please verify correct href was passed in.'. I`m testing this href in http://developers.facebook.com/tools/debug - it says correct answer, but frame not working.
In access logs for UA facebookexternalhit/1.1 always answer status 200 (and 301/302 for specific page).
example page: http://www.now.ru/item/series/comedy/Univer_222394
additional information: on some pages frame works, and some does not work
thanks.
The Facebook Like Box is really designed to use the URL for a Facebook page, not for a general Web Page. It pulls Timeline content from a fan page within Facebook.
It can be used for a Web Page if the page has defined Open Graph Meta Tags and has been Liked at least once. However, there will be no "stream" functionality. The Like-Box for a Web Page would just have functionality similar to the Facepile plugin (except that Facepile just shows you friends, and a Like-Box also shows non-friends.)
Typically, though, you would want to supply the Like-Box with a Facebook Page URL in the following format:
http://www.facebook.com/pages/Facebook-Page-Name/Facebook-Page-ID
Perhaps you are intending to use a Like Button or Facepile Social Plugin instead? Either of those can accept any URL as input.

How to force facebookexternalhit to reaccess?

I'm playing with facebook links via posting them. On the frist time a access from a user agent containing "facebookexternalhit" will visit your site and look for some meta tags.
So far so good that works. But if I try to repost the link no furure calls happens. How can I trigger to let facebook read the page again?
Are there some API calls I can use to trigger an update?
in the documentation for the Like Button it says:
When does Facebook scrape my page?
Facebook needs to scrape your page to know how to display it around
the site.
Facebook scrapes your page every 24 hours to ensure the properties are
up to date. The page is also scraped when an admin for the Open Graph
page clicks the Like button and when the URL is entered into the
Facebook URL Linter. Facebook observes cache headers on your URLs - it
will look at "Expires" and "Cache-Control" in order of preference.
However, even if you specify a longer time, Facebook will scrape your
page every 24 hours.
The user agent of the scraper is: "facebookexternalhit/1.1
(+http://www.facebook.com/externalhit_uatext.php)"
The Linter is now known as the Facebook Debugger and when you use it for a url, it will clear the facebook cache for the same url and will then cache the new result.
One trick you can use is to simply append a "random" GET parameter to the URL that you're sharing. It won't have any effect on the page's content, but will cause Facebook's scraper bot to reaccess your site.
Original URLs:
http://example.com
http://example.com?param=1
New URLs that will force a "reaccess":
http://example.com?cache_buster=784932789532
http://example.com?param=1&cache_buster=784932789532

Sharing an app that is on a facebook fan page

Afternoon,
I have a facebook application that i have added to a facebook fan page, this application has an URL like http://facebook.com/fanPage?sk=app_id. Now i if copy this link and try and share it on the facebook fan page it uses the description/image from the page and not from the application like it want.
Is there any way to change this? The correct meta tags are in place.
Peter
yes there is a way, but not directly. facebook always fetches the meta tags of the top page, as your app runs in an iframe its not fetched.
but you can submit a wallpost (as user or as a fanpage) via the api and give alle information you want. (like image, video, description, title, ....)
see http://www.fbrell.com/fb.ui/feed for an example.
An other variant:
You add a canvas app beside your facebook app. (see the app settings) on this page you add the meta tags for the wallposts, and a javascript which redirects to the fanpage like
top.location.href = 'http://www.facebook.com/mypage?sk=app_id'
when ever you want to share you use the canvas app url. Facebooks greper ignores the javascript redirects but read the meta tags. A user clicking the wallpost is automaticly redirected to the fanpage - tab.