When posting a link directly to a Tab on a Facebook Page,
https://www.facebook.com/PAGENAME?sk=app_APPID
Facebook picks up the Page's Open Graph <meta>
tags, which means the link post gets associated with the Page's profile picture, name, and a description of "Page • n
like this".
I had hoped that Facebook would instead use the og
<meta>
tags from the app's HTML, allowing link posts to be customized.
What's the best way to provide a direct link to a specific Tab on a Facebook Page with custom content in the link post?
The best way I can see to have this accomplished would be to have a redirector page hosted on a website (www.example.com/fb/redirectorForApp.html) that does a redirect on a javascript timeout. That redirector page has the og tags you want to have specified. The redirect will land the person at the https://www.facebook.com/PAGENAME?sk=app_APPID
. What's cool about the javascript redirect is that the redirect is not ran by the linter, so it can pickup the correct og: tags, while also allowing you to have the user go directly to the page tab. Good luck!
Since the content of your Page Tab is located inside an iFrame the Facebook scraper will always see first the meta tags outside the iFrame which are set by Facebook and which describe your Facebook Page. Try the url in the Facebook tool and see at the bottom of the page what the scraper sees for your url. Unfortunately you can not change those Facebook meta tags from within your iFrame. That is why the only way to achieve what you want is to go by a redirect. I have done this before using the following code:
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" xmlns:og="http://ogp.me/ns#">
<head>
<!-- Facebook meta tags -->
<meta property="og:title" content="bla"/>
<meta property="og:url" content="https://yourdomain.com/redirect.html"/>
<meta property="og:image" content="https://yourdomain.com/thumb.png"/>
<meta property="og:site_name" content="bla"/>
<meta property="fb:admins" content="1234"/>
<meta property="og:description" content="bla"/>
<meta property="og:type" content="website"/>
<meta property="og:video" content="https://yourdomain.com/bla.swf?param=bla"/>
<meta property="og:video:width" content="398"/>
<meta property="og:video:height" content="224"/>
<meta property="og:locale" content="de_DE"/>
<script type="text/javascript" src="swfobject.js"></script>
</head>
<body>
<!-- Check whether inside facebook -->
<script type="text/javascript">
function NotInFacebookFrame() {
return top === self;
}
function ReferrerIsFacebookApp() {
if(document.referrer) {
return document.referrer.indexOf("facebook.com") !== -1;
}
return false;
}
if (NotInFacebookFrame() || ReferrerIsFacebookApp()) {
top.location.replace("https://www.facebook.com/PAGENAME?sk=app_APPID");
}
</script>
<!-- content here -->
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With