Consider the panel below.
This is actually a gadget that embeds this url - xliberation.com/b/but.html?refer=parent. Here's the code.
This is a general purpose panel that i'm including not only in Google sites, but also other web sites, and potentially other iframe scenarios. So to make all this happen, you need to call it with a parameter of ?refer=parent. Here's the code
Google plus will use the canonical link for the page if there is one - so for that we can simply set it to the gadgets parent url, which we've figured out in the butGetHref function.
That will fool this google plus link into sharing the pages link, rather than the panel link or the gadget link
This is a little more complicated - we are going to create the button on the fly.
First create somewhere to put it
<div id="tbut" class="butbutsections"></div>
Then build the button on the fly, substituting in the calculated url, and include the twitter js to make it active.
This is similair to the approach for Twitter. We create a spot for the button, then dynamically update the script attribute to use the data-url returned from our bufGetHref() function.
I dont have a facebook account, and don't really want to get one. Any volunteers to figure this one out?
You want to learn Google Apps Script?
Learning Apps Script, (and transitioning from VBA) are covered comprehensively in my my book, Going Gas - from VBA to Apps script, available All formats are available now from O'Reilly,Amazon and all good bookshops. You can also read a preview on O'Reilly.
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Things that have been deprecated >