Shane Jones

Co-Founder of Peadig, Freelance Developer and Consultant to Agencies in the North West

This post was written 3 years ago and therefore may not be as accurate as more recent posts.

Here is some code that allows you to have a HTML Valid Facebook Like Box?

Move the Facebook code into a document.write JS function and it will all validate.

<div id="fb-root"></div>
<script type="text/javascript">(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/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

/* <![CDATA[ */

document.write('<div class="fb-like" data-href="shanejones.co.uk" data-send="true" data-width="450" data-show-faces="true" data-font="arial"><\/div>');

/* ]]> */</script>

Categories: Facebook Dev

Tags: ,
Shane Jones

Posted by

Shane is the Co-Founder of Peadig, the WordPress framework and has gained over 40,000 downloads of his WordPress plugins. Shane also likes to tinker with API's and specialises in Facebook, Twitter, Instagram and Foursquare API. The views expressed in Shane's posts are his own and are not necessarily the views of his employers.

Leave a Reply