So far I've these 3 social buttons at the end of the page. I was thinking that rewriting same function 3 times isn't very smart. Could I unite them? would it work?
Any ideas how to do this? logically I would do: g.src = 'http://apis.google.com/js/plusone.js', 'http://connect.facebook.net/en_US/all.js#xfbml=1', 'http://platform.twitter.com/widgets.js';
but I'm not sure if this correct way to do it...
<script type="text/javascript">
//<![CDATA[
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.async = true;
g.src = 'http://apis.google.com/js/plusone.js';
s.parentNode.insertBefore(g, s);
})(document, 'script');
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.async = true;
g.src = 'http://connect.facebook.net/en_US/all.js#xfbml=1';
s.parentNode.insertBefore(g, s);
})(document, 'script');
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.async = true;
g.src = 'http://platform.twitter.com/widgets.js';
s.parentNode.insertBefore(g, s);
})(document, 'script');
//]]>
</script>
This is my solution, tested on Chrome and Mozilla under Linux!
Try: