[英]how to share a url with # in twitter using tweet_button.html
我有一個帶有onclick功能tweetpage的Twitter img
<img src="images/twtr.png" onclick="tweetPage();"/>
function tweetPage()
{
var url = "http://www.website.com/index.html#eyJkIjoidGhpcyBpcyBh";
var testUrl ="https://platform.twitter.com/widgets/tweet_button.html?url="+url
var htmlStr = '<iframe allowtransparency="true" frameborder="0" scrolling="no"'
+'src="'+testUrl+'"'
+'style="width:130px; height:20px;padding-top: 37%;"></iframe>'
$('#twitLindDiv').html(htmlStr);
}
並顯示一個tweetbutton。 單擊tweet按鈕,會顯示一個twitter彈出框,但文本框中的url僅包含
我該如何解決。
我也試過
&hashtags =代替#
結果是
http://www.website.com/index.html #eyJkIjoidGhpcyBpcyBh
我該如何解決
tweetid是向其添加此內部html的div(對我而言效果很好)。
var referenceUrl = window.location.toString();
var shareUrl = 'http://www.website.com/index.html#eyJkIjoidGhpcyBpcyBh'
$('#tweetid').html('<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.1368146021.html#_=1369640770351&
count=none&
id=twitter-widget-0&
lang=en&original_referer='
+encodeURIComponent(referenceUrl)
+'&related=nothing%20to%20worry&size=m&
text=LiveImpact&
url='+encodeURIComponent(shareUrl)
+'" class="twitter-share-button twitter-count-none" title="Twitter Tweet Button" data-twttr-rendered="true" style="width: 56px; height: 20px;">'
+'</iframe>');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.