Note Board–Comment on external sites
While reviewing the new social features I noticed this interesting hyperlink on the “My Profile” page. It allows users to bookmark a special link which they can use to extend “I like It” and “Tags & Notes” features beyond SharePoint to comment on external websites.
I was curious to look under the hood and understand how this could be done technically.
A complete JavaScript function is added to your bookmark in the URL field and executes when clicked. The browser context holds the external site’s detail and is passed to SharePoint as GET parameter in the URL. There is a safety check for SharePoint sites. If the dialog function exists (CORE.JS) then we can assume we are on a SharePoint page and display the dialog instead of a full page.
The special character escaping is very clever and gives us a single line of text which JavaScript can execute.
ORIGINAL
javascript:var%20d=document,l=d.location,e=encodeURIComponent,du='http:u002fu002fsp2010:8080u002f_layoutsu002fSocialDataFrame.aspx',u=du+'?Title='+e(d.title)+'&Src=bm'+'&DisplayUrl='+e(l.href)+'&Url='+e(l.href); if (typeof(OpenTagDialog)=='function') { OpenTagDialog(du);}else{ if(!window.open(u,null,'toolbar=0,status=0,resizable=0,scrollbars=1,width=650,height=400')) { l.href=u; }}void(0);SPACED FOR EASY READING
javascript:
var%20d=document,
l=d.location,
e=encodeURIComponent,
du='http:u002fu002fsp2010:8080u002f_layoutsu002fSocialDataFrame.aspx',
u=du+'?Title='+
e(d.title)+
'&Src=bm'+
'&DisplayUrl='+
e(l.href)+
'&Url='+
e(l.href);
if (typeof(OpenTagDialog)=='function') {
OpenTagDialog(du);
}
else
{
if(!window.open(u,null,'toolbar=0,status=0,resizable=0,scrollbars=1,width=650,height=400')) {
l.href=u;
}
}
void(0);

Jeff,
I too was all excited about this feature to share links within SharePoint, but recently found out that others will not see it because it’s security-trimmed :(.. See this link (search for ACL to get the relevant bit): http://blogs.msdn.com/b/spses/archive/2011/02/05/social-computing-part-3-activity-feeds-social-ratings-tags-and-notes.aspx
– Louis
Thanks Louis. That’s a great article! Incredibly detailed and I really like the diagrams. I wonder if there’s any way to disable the trimming, just to share more openly. I mean the worst case is somebody sees “access denied” but at least that way they could learn and become aware of new content. That was the intent right? =)