Getting device filters, add this and .net to work together

←Back to listing

An issue I’ve come across a few times when adding an Add This button to any .net application is that the following error message is thrown:

The string 'fb:like:layout' contains too many device filters. There can be only one.

There’s something about the Highlander with that one, and it’s a bit irritating to say the least, but the fix is a simple one.

All you need to do is to enter the required Add This code without the device filters, and then add them with javascript (I use jQuery here):

<div class="addMe">
   <!-- AddThis Button BEGIN -->
   <div class="addthis_toolbox">
      <a class="addthis_button_facebook_like"></a>
      <a class="addthis_button_tweet"></a>
      <a class="addthis_counter addthis_pill_style"></a>
   </div>
</div>
									

<script type="text/javascript">
      jQuery('.addthis_button_facebook_like').attr('fb:like:layout', 
'button_count');
   </script>
   <script type="text/javascript" src="http://s7.addthis.com/js/250/
addthis_widget.js#username=xxx"></script>
<!-- AddThis Button END -->
									

I’m not quite sure why .net throws this error, and it’s a shame that javascript is required to fix it, but for now it’ll do.