Thursday 14 March 2013

Facebook Share in ASP.NET

1. Put the below script inside the <head> tag

<script type="text/javascript">
       function fbs_click() {
           u = location.href; t = document.title; window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u) +
    '&t=' + encodeURIComponent(t), 'sharer', 'toolbar=0,status=0,width=626,height=436');
           return false;
       }</script>


2. Next call the script function inside the <a> tag like the following:

<a href="http://www.facebook.com/share.php?u=<url>" onclick="return fbs_click()" target="_blank">

No comments:

Post a Comment