Displaying Facebook Like Box with Valid HTML
- 10 October, 2011 -
- Facebook Dev -
- Tags : Facebook, Social Plugins
- 1 Comment
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-box" data-href="http://www.shanejones.co.uk" data-width="292" data-show-faces="true" data-stream="true" data-header="true"></div>');
/* ]]> */
</script>
You are the man!
THX