Can I use a ShareThis/AddThis Button if my site

2019-05-31 10:55发布

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?

2条回答
我命由我不由天
2楼-- · 2019-05-31 11:34

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

查看更多
Ridiculous、
3楼-- · 2019-05-31 11:49

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>
查看更多
登录 后发表回答