An Important Update

Dear Followers Of This Blog ...

If you did not use a Blogger / Google account when you Followed this blog, years ago, you are probably not Following now . During the past...

Sunday, December 20, 2015

Diagnose FaceBook Gadget Problems

Adding a FaceBook developed gadget is - or should be - just like adding any HTML / JavaScript gadget.

Sometime, though, adding a FaceBook gadget just does not produce hoped for results. We see the problem reports in Blogger Help Forum: Get Help with an Issue.
The gadget is blank!
or
The gadget does not update anything!
The problems will typically involve gadget code - and the FaceBook Debugger wizard is unlikely to provide any help.

FaceBook supplied gadgets, when provided by FaceBook Developers from their website, are probably almost as reliable as Blogger supplied gadgets, installed using "Add a Gadget" - Basics.

Even so, adding a FaceBook Developers provided gadget is subject to known gadget problems - and some problems, unique to FaceBook gadgets.
  • Adding a third party gadget, not provided by FaceBook Developers.
  • Editing an HTML gadget, in "Rich Text" mode.
  • Using the "Add your own" code, instead of the "HTML / JavaScript" gadget.
  • Lacking the Facebook SDK for JavaScript.

Adding a third party gadget, not provided by FaceBook Developers.

Only add official FaceBook Developers gadgets, from the official FaceBook Developers website. Some known hackers have been distributing FaceBook branded gadgets, from their websites.

Using a FaceBook branded gadget, not provided by FaceBook Developers, will not be good for your blog, in the long run.

Editing an HTML gadget, in "Rich Text" mode.

If you add HTML / JavaScript code to a standard gadget, and you edit the gadget in "Rich Text" mode, the gadget will not work. Perversely, Blogger gadgets edited in "Rich Text" mode will display the caption "Edit Html".

If you edit an HTML / JavaScript gadget, with "Edit Html" displayed, you will be in "Rich Text" mode - and your HTML / JavaScript code will be interpreted as rich text. The gadget will not work.

When you edit HTML / JavaScript code, such as FaceBook gadget code, always do so with "Rich Text" displayed as a caption.

Using the "Add your own" code, instead of the "HTML / JavaScript" gadget.

When you add an "HTML / JavaScript" gadget, you must select "HTML / JavaScript" from the "Basics" menu, as found in the "Add a Gadget" wizard. The "Add your own" menu tab provides a shell for adding XML coded gadgets.

Almost everybody who reads these instructions will need to use the "HTML / JavaScript" gadget in "Basics". The few of you who do not will know when to use "Add your own", and when to use "Basics".

Lacking the Facebook SDK for JavaScript.

FaceBook gadgets need the FaceBook SDK for JavaScript. Blogger blogs with standard templates will have the SDK already - as most Blogger blogs routinely contain one or more FaceBook buttons.

The "Share Buttons" toolbar, for instance, contains a FaceBook Share button.

Some Blogger blogs - like some third party templates - may not routinely load the FaceBook SDK. If a genuine FaceBook Developers gadget, added using "Add a Gadget" - Basics, edited in HTML mode, does not work, it may need the SDK loaded. This is not difficult to do.

The SDK code can be added into an existing Blogger HTML gadget - or you may use a separate gadget. If you are adding a single FaceBook gadget - as in this exercise - simply add the SDK code in front of the FaceBook gadget code.

You might have:
<!-- Your like button code --> <div class="fb-like" data-href="http://www.your-domain.com/your-page.html" data-layout="standard" data-action="like" data-show-faces="true"> </div>
Add the SDK code:
<!-- Load Facebook SDK for JavaScript --> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <!-- Your like button code --> <div class="fb-like" data-href="http://www.your-domain.com/your-page.html" data-layout="standard" data-action="like" data-show-faces="true"> </div>

And that will be that.

The bottom line is simple.

If you are adding a FaceBook gadget, simply add a standard "HTML / JavaScript" gadget, with the necessary FaceBook code. It is not necessary to use the Template Editor - nor will you need XML escape code, enveloping the HTML / JavaScript code.

Keep it simple, get it working - and get back to work, in your blog.

Dude, hit me with a comment!