我想在 Facebook 分享按钮中提供一个不同的 url,而不是当前页面的 url。
我试图在后面更改 asp.net 中的 url,但我没有成功。
如果有人能对此提供帮助,我将不胜感激。
我使用的一些代码,您可以在下面看到。
这是前端脚本
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript">
</script>
<script type="text/javascript">
function fbs_click() {
u = location.href;
t = document.title;
window.open('http://www.facebook.com/share.php?u=' + encodeURIComponent(u) +
'&t=' + encodeURIComponent(t), 'share', 'toolbar=0,status=0,width=626,height=436');
return false;
}
</script>
这是分享按钮
<a name="fb_share" runat="server" id="aFbShare" type="button" class="sharelink">Paylaş</a>
这就是我在背后做的
string wishListUrl = SEOHelper.GetWishlistUrl(NopContext.Current.User.CustomerGuid);
aFbShare.Attributes.Add("onclick", "fbs_click()");
aFbShare.Attributes.Add("target", "_blank");
aFbShare.HRef = "http://www.facebook.com/share.php?u=" + wishListUrl;