Reputation: 32899
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.
Upvotes: 4
Views: 2697
Reputation: 165
the trick is to replace the hash sign with its html encoded character which is : %23
Upvotes: 13
Reputation: 318468
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.
Upvotes: 0