Skip to content

Instantly share code, notes, and snippets.

@andershaig
Created May 15, 2012 14:36
Show Gist options
  • Save andershaig/2702260 to your computer and use it in GitHub Desktop.
Save andershaig/2702260 to your computer and use it in GitHub Desktop.
Sharing Popup using Facebook's Share Method
<script type="text/javascript">
$(document).ready( function () {
var url = encodeURIComponent('https://www.youtube.com/watch?v=ya7OVaIu7Yg');
var title = encodeURIComponent('This is my super awesome title');
var full_url = 'http://www.facebook.com/sharer.php?u=' + url + '&t=' + title;
$('#fb_share').click( function (e) {
e.preventDefault();
window.open(full_url);
});
});
</script>
<button id="fb_share">Click to Share</button>
{% plugin rawtext url %}
{% plugin rawtext title %}
<button id="fb_share" onclick="window.open('http://www.facebook.com/sharer.php?u={{ url | json }}&t={{ title | json }}','_blank','height=440,width=625,scrollbars=no');">Share on Facebook</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment