Pages

Wednesday, December 28, 2011

Add a Facebook Like and Facebook Comments to your Google Site

I managed to add a Like Button and a Facebook Comment on my google site.

To do so I had to develop a custom Google Gadget that embeds the javascript code.


That's not so complex.

What was less simple, was to find the code to get the page url where the gadget is embedded.

I found it on stackoverflow (thanks to Vaibhav) :

var url = (window.location != window.parent.location) ? document.referrer: document.location;
 
You can see the result here (go to the bottom of the pages):

0 comments: