In a previous post, we showed you the CSS necessary to make custom Share link in an FBML app or application tab. Since FBML is being deprecated, this obviously won’t work anymore.
tag on your HTML page:
appId : ‘YOUR APP ID’,
YOUR APP ID text should be replaced with your actual application ID.
Once again, if you’re already using jQuery in your app, you should not include it again – but if you’re not, place this line of code in between the
tags of your HTML page:
This goes in the head of your HTML page, and simply sets the parameters that you’re going to be passing to your custom Share link, and associates it with a CSS id (in this example,
fbsharebutton) so that jQuery can use it.
caption: ‘Taking the Hell out of Facebook Development’,
description: ‘There is some really helpful stuff here!’,
message parameter has been (or is being) deprecated by Facebook, so it’s not wise to rely on it here. Replace the sample FBMHell text with text that makes sense for your site or application. The
picture parameter is the url to the 100×100 image that will be included with the shared post in the newsfeed.
Note that the
source parameter (which is optional) will allow you to embed video content from a whitelisted source, like YouTube, directly into the newsfeed on the share.
Now all that’s left is to create the link. You can use text or an image, it doesn’t matter, as long as you include the CSS ID of
fbsharebutton, since that’s the CSS id we used in the jQuery code above.
<img src="/images/share_me.png" id="fbsharebutton"/>
or to use text as a link:
<span id="fbsharebutton">Click me to share</span>
This will result in the familiar Facebook-styled modal popup window when the image or link is clicked.