The Facebook Share Widget in Action
I recently discovered the official Facebook Share Widget, which allows your website or blog content to be shared on Facebook, and added it to a website I am developing. See the picture at the right, it’s a very cool widget and easy for readers to use.
The problem I ran into, which is very annoying to a perfectionist like myself, is that the little box showing the count is only displayed after the page has been shared 3 or more times. Until then all you see is the small dark blue button below it. This can really throw off your page layout and ruin the aesthetics of your page when you’re expecting to have the full widget displayed.
Here is the HTML that is generated when you use the Facebook Share code generator:
The problem lies within the FB.Share script used by the widget, so the first thing you need to do is download a local copy of this script from the URL below (right-click and Save Link As…):
Next, replace the text
This changes the default value for the minimum display count from 3, to 0; effectively forcing the count box to always be displayed.
Finally, update the script reference in your code to use your local copy like in the code below.
For example, create a custom script manager control and include it in your site’s master page file:
<asp:ScriptManager ID="ScriptManager1" EnableCdn="true" EnablePartialRendering="true" LoadScriptsBeforeUI="true" runat="server">
<asp:ScriptReference Path="~/Scripts/FB.Share.js" />
Please leave a comment and share this with your friends if you found this useful.