Quick Fix for AddThis.com’s Facebook Like Button in IIS7.0

In this post I will be addressing how to fix an error with AddThis.com’s Facebook Like button, that results int he following error:

Parser Error Message: The string ‘fb:like:layout’ contains too many device filters. There can be only one.

But first a bit of background: Addthis.com is one of the most popular widgets out there for social sharing. With a few simple clicks you can provide your users with the ability to easily share your content pretty much everywhere.

One of the features they offer is the ability to add the “Facebook Like” button, and for that, their code generator will give a snippet containing  something like this:

<a class="addthis_button_facebook_like" fb:like:layout="button_count"> </a>

What they are doing is passing extra information to their widget on how to display the facebook like button. However, IIS 7.0 seems to get confused by the colons in the attribute name (‘fb:like:layouts) and thows a parser error. Interestingly enough, this only happens when they are two colons in the attribute name; one colon will work (try it).

I did not have time to investigate the root cause of this; however I needed a quick fix, and it basically came to this: Add the property with Javascript!

1. Remove problematic the attribute from the tag, and add an id so you can recognize it later. The tag will then be as follow:

<a class="addthis_button_facebook_like" id="facebookLike"> </a>

2.  Now add some javascript to manually add the property, I am using  jQuery, and it looks like this::

$(function () { $("facebookLike").attr("fb:like:layout","button_count");});

That is it! A simple and fast work around 🙂

For reference:

Author: ricardocovo

Senior Software Architect/Developer with extensive experience in web related technologies.

4 thoughts on “Quick Fix for AddThis.com’s Facebook Like Button in IIS7.0”

  1. You can do it even more simply. Just use C# tags, like this -> <a class="addthis_button_facebook_like" =”button_count”>???

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: