【问题标题】:Change URL of the twitter 'share button'更改推特“分享按钮”的 URL
【发布时间】:2018-05-22 10:51:51
【问题描述】:

我想将URL 添加到指向目标页面部分的Twitter“分享按钮”。

我正在使用此代码:

<div>
<a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=The process...random text. mezet.xyz/dl18/manifesto/#section" data-size="large">
Tweet</a>
</div>

【问题讨论】:

  • 点击推特帖子,它将作为一个新的弹出窗口打开,复制您在域栏中看到的网址,并将其粘贴到href标签中。
  • #section1 表示您希望它转到该页面链接的 id 标记。如果id= section1 可用,您可以这样做吗?我不确定我是否理解 100% 正确
  • 如果我点击该链接mezet.xyz/dl18/manifesto/,它会将我带到一个没有标签ID 的页面,称为section1,所以假设您希望用户看到Our Priorities 的网址将看起来像这样http://mezet.xyz/dl18/manifesto/#priorities-section,因为它指向div 中的id,称为priorities-section
  • 你必须自己编辑推特上的推文,你不能在diva标签内更改推文的文本(url)。
  • 一个解决方法可能是在指向 http://mezet.xyz/dl18/manifesto/#section1div 周围添加一个 a 标签,记住将 style="display:block" 添加到 div 否则它不会正确包装。但是更改推文的文本我无法帮助您。

标签: html url twitter


【解决方案1】:

希望它是您所寻找的。如果您想发布带有url 的推文以将您带到链接id 的页面的某个部分,对于twiiter,您不能在url 中使用#,操纵# 标签使用以下内容。

添加:%23 作为 # 标记

<div>   
    <a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=The process...of this is just total dummy text to test if i can manupilate the url. http://mezet.xyz/dl18/manifesto/%23priorities-section " data-size="large">Tweet</a>
</div>

运行代码片段,右键单击“Tweet”和open link in new tab。您将看到添加了 # 标记的 URL。

【讨论】:

  • 我得到这个结果:这个过程......这只是测试我是否可以操纵网址的总虚拟文本。 mezet.xyz/dl18/manifesto/#priorities-section ... mezet.xyz/dl18/manifesto 它共享两个网址。通过添加 url insisde tweet?text. 我得到了相同的结果
  • 如果你把它用作我的代码 sn-p ,你点击推文 a 标签文本,你会在文本 sn-p 之后看到带有 url 的帖子,如果你发推文并且点击链接,它应该带你到`mezet.xyz/dl18/manifesto/#priorities-section`
  • 忘记 div 周围的 a 标签,只需使用 %23 操作 url # 标签
  • 如果我看一下你的推文活动,看起来效果不错?
猜你喜欢
  • 2012-06-03
  • 1970-01-01
  • 2015-02-19
  • 2013-03-11
  • 1970-01-01
  • 1970-01-01
  • 2012-03-22
  • 1970-01-01
  • 2018-05-22
相关资源
最近更新 更多