问题
I want to embed a ShareThis/AddThis button on my site but the site's navigation relies on Hash tags in the url. Each page is assigned a unique hash value (ie, http://domain.com/index.php#products). Changing the navigation/page design isn't an option. Will these service preserve the hash value (both embed JS on the page)? If they don't, what are some alternative solutions?
回答1:
Just replace the # with %23 (the URL encoded version of #) and you'll be fine. ;) I like to use the "remote" version of addthis : http://www.addthis.com/bookmark.php?url=your_url_here%23hash_tag_here
回答2:
The javascript button's share-url can be set manually for both services.
AddThis docs: http://www.addthis.com/help/sharing-api
Excerpt from ShareThis doc's (http://blog.sharethis.com/faq/developers-faq/sharethis-api-examples/)
Define Your Sharable Objects:
Using the ShareThis API, it is easy to define the sharable objects. As an example, a website that sells products is able to define such detail as title, description, product image. When an item is shared, the recipient will be able to see all the details defined. Here is an example of code that could be used:
<script language="javascript" type="text/javascript">
SHARETHIS.addEntry({
title:'Best Digital Camera',
summary:'This digital camera has all the features one would ever need!',
url:'http://mystore.com/digitalcamera',
icon: 'http://path.to/icon'
}, {button:true} );
</script>
来源:https://stackoverflow.com/questions/2835621/can-i-use-a-sharethis-addthis-button-if-my-sites-navigation-relies-on-hash-tags