Facebook Sharer popup window

Asked
Active3 hr before
Viewed126 times

3 Answers

windowfacebookpopup
90%

If you want to add custom metadata, use following code:,Connect and share knowledge within a single location that is structured and easy to search., this is a continue (and solution) to my other question about "og-meta tags for several share buttons" - stackoverflow.com/questions/14818698/… - thank you Stichoza – no0ne Feb 13 '13 at 9:38 ,Find centralized, trusted content and collaborate around the technologies you use most.

If you want to add custom metadata, use following code:

<a id="fb-share" style='text-decoration:none;' type="icon_link" onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=YOUR_TITLE&p[summary]=YOUR_DESCRIPTION&p[url]=YOUR_URL&p[images][0]=YOUR_IMAGE','sharer','toolbar=0,status=0,width=580,height=325');" href="javascript: void(0)">Share</a>

Javascript:

function fbShare(url, title, descr, image, winWidth, winHeight) {
   var winTop = (screen.height / 2) - (winHeight / 2);
   var winLeft = (screen.width / 2) - (winWidth / 2);
   window.open('http://www.facebook.com/sharer.php?s=100&p[title]=' + title + '&p[summary]=' + descr + '&p[url]=' + url + '&p[images][0]=' + image, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
}

HTML:

<a href="javascript:fbShare('http://jsfiddle.net/stichoza/EYxTJ/', 'Fb Share', 'Facebook share popup', 'http://goo.gl/dS52U', 520, 350)">Share</a>
load more v
88%

The Workplace Share Dialog can be launched in a new tab or in a browser popup window, and requires a parameter for the URL of the object you're sharing. The Workplace Share Dialog assumes an active Workplace session. It can be invoked via the generic subdomain work.workplace.com, but will immediately redirect to the active user's company subdomain.,The Workplace Share Dialog takes the following parameters:,When you pass a private URL to Workplace, you can ensure that Workplace shows a rich preview to people who can see it, by enabling support for Authenticated Previews.,Workplace supports several ways to share content from apps or websites, including the Workplace Share Dialog for web and Workplace Share Extension on mobile.

You can launch the dialog by placing a button on your UI and adding a JavaScript handler that uses window.open to launch a new window. For example:

<button onclick="share()">Share to Workplace</button>
<script>
share = function(){
    url = 'https://work.workplace.com/sharer.php?display=popup&u=' + window.location.href;
    options = 'toolbar=0,status=0,resizable=1,width=626,height=436';
    window.open(url,'sharer',options);
}
</script>
load more v
72%

How can I display the correct data in the popup window?,The FB sharer popup window displays the data of the page, not the metadata I have inserted in the php link.,I wrote a little JS code for Facebook Share.,Facebook Developer APPS

The FB sharer popup window displays the data of the page, not the metadata I have inserted in the php link.

<a href="http://www.facebook.com/sharer/sharer.php?s=100&p%5Btitle%5D=Google&p%5Burl%5D=http%3A%2F%2Fwww.google.com&p%5Bsummary%5D=Google search engine&p%5Bimages%5D%5B0%5D=https://www.google.com/images/srpr/logo3w.png
" onClick="return fbs_click(626, 305)" target="_blank" title="Share">FACEBOOK</a>

It seems the to be caused by the javascript

<script type="text/javascript">
function fbs_click(width, height) {
var leftPosition, topPosition;
leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
topPosition = (window.screen.height / 2) - ((height / 2) + 50);
var windowFeatures = "status=no,height=" + height + ",width=" + width + ",resizable=no,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no";
u=location.href;
t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer', windowFeatures);
return false;
}
</script>
load more v

Other "window-facebook" queries related to "Facebook Sharer popup window"