簡體   English   中英

如何使用tweet_button.html在Twitter中與#共享URL

[英]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僅包含

http://www.website.com/index.html

我該如何解決。

我也試過

&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&amp;
count=none&amp;
id=twitter-widget-0&amp;
lang=en&amp;original_referer='
+encodeURIComponent(referenceUrl)
+'&amp;related=nothing%20to%20worry&amp;size=m&amp;
text=LiveImpact&amp;
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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM