Can I use a ShareThis/AddThis Button if my site's navigation relies on Hash tags in the url?
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#prod开发者_高级运维ucts). 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?
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
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>
精彩评论