![](/img/trans.png)
[英]how to share a url with # in twitter using tweet_button.html
[英]Automatic url shortening with a custom Twitter tweet button
有沒有辦法讓twitter在使用自定義按鈕時生成我的URL的縮短版本(根據: https : //dev.twitter.com/docs/tweet-button#build-your-own )。
我不需要任何計數器,我只想分享文本,縮短網址和標簽。
var twUrl = 'http://twitter.com/share?count=none&text=' + encodeURIComponent(text) + '&url=' + url + '&hashtags=' + encodeURIComponent(hashtags);
window.open(twUrl, 'sharer', 'toolbar=0,status=0,width=650,height=254');
謝謝!
您可以使用bitly API來縮短網址。
查看文檔: http : //dev.bitly.com/get_started.html
另請參閱此SO問題,答案中的代碼示例如何使用jquery使用bitly API: jQuery on the fly URL shortener
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.