2012-07-30 63 views

回答

15

不需要圖書館。每項服務都提供易於使用的代碼片段,以便爲其服務提供共享按鈕。將每個代碼片段放置在您的視圖中,您想要的位置。

+0

爲了方便起見,我如何讓用戶在發送推文之前登錄? – James 2012-07-30 16:32:09

+1

@詹姆斯我相信Twitter會爲你照顧這件事。如果用戶沒有登錄,在發送推文之前,她會被提示。 – 2012-07-30 16:39:45

0

是每一個服務提供商在他們的開發領域提供的代碼,但你需要學習並通過一個單獨一個分析,這裏是所有的一環。

LinkedIn分享:

<script src="//platform.linkedin.com/in.js" type="text/javascript"></script> 
<script type="IN/Share" data-onsuccess="lnksuccess" data-onerror="error" data-url="<%=strShareUrl %>"></script> 

**CallBack Function :** 
<script> 
    function lnksuccess(url) { 
    alert("url = " + url + " shared successfully"); 
    } 
    function lnkerror(url){ 
    alert("something goes wrong in url sharing"); 
    } 
</script> 

看看這個更多的(參考)。

Social share buttons for facebook, twitter, linkdin in asp.net

1

如果你不想使用不同的JavaScript文件分享您的內容,然後簡單地可以使用此代碼,它是快,因爲無需等待的JavaScript文件從不同的網站加載,您需要下載易於在線獲取的不同圖片

//facebook share 
<a href="https://www.facebook.com/sharer/sharer.php?  
    [email protected](Request.Url.ToString())&[email protected](Title)" 
    target="_blank"> 
    <img src="/images/social-buttons/Facebook.png"> 
</a> 

// twitter 
<a href="https://twitter.com/intent/tweet? 
    [email protected](Request.Url.ToString())&[email protected](Title)" 
    target="_blank" title="Tweet"> 
    <img src="/images/social-buttons/Twitter.png"> 
</a> 

// google 
<a href="https://plus.google.com/share? 
    [email protected](Request.Url.ToString())" 
    target="_blank" title="Share on Google+"> 
    <img src="/images/social-buttons/GooglePlus.png"> 
</a> 
+0

@ url.Encode(Title)中的標題是什麼 – 2015-10-20 09:15:50

+0

要分享的信息的標題 – 2015-10-20 13:35:53

相關問題