-
-
Save wallace57/39a92b1b142b58d95d8b to your computer and use it in GitHub Desktop.
Adding action links to posts using JavaScript and the FB.UI Feed dialog.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="well"> | |
<button class="btn btn-info share-btn">Share</button> | |
</div> | |
<script type="text/javascript"> | |
function fb_share() { | |
FB.ui( { | |
method: 'feed', | |
name: "Search Google", | |
link: "https://www.google.com", | |
picture: "https://www.google.co.uk/images/srpr/logo11w.png", | |
caption: "The world's most popular search engine", | |
actions: {"name":"Search", "link":"http://www.google.com"} | |
}, function( response ) { | |
// do nothing | |
} ); | |
} | |
$(document).ready(function(){ | |
$('button.share-btn').on( 'click', fb_share ); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment