简体   繁体   中英

Twitter share button: share hash part of URL?

I have a site that dynamically updates the URL hash as the user navigates through it (it's a Backbone.js app and I'm using pushState).

I'd like the user to be able to tweet the full URL, including the hash.

I'm using the Twitter share button, but it seems to only share the basic URL path, not the hash, which is quite important:

<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>

Any ideas for how I can let users share the hash as well?

Thanks for your help.

诀窍是用它的html编码字符替换哈希符号,即:%23

Does that button use the referer? If yes, you are out of luck - the hash is never sent to the server .

However, when using pushState you don't need a hash unless the user's browser is too old - but for everyone with a recent browser it should work fine as the referer will be whatever is currently used in the address bar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM