Dealing with < in tw:counturl addthis plugin

泄露秘密 提交于 2019-11-30 19:20:01

问题


I have an addthis plugin for displaying total number of tweets in my blogspot blog. I use it this way If i mention tw:counturl="my_specific_blogger_url" > it shows the exact number of tweets. But the problem is that in that case I can use only one link. To retrieve specific blog page url I use <data:blog.url/>. But if i use it in tw:counturl in the following way:

tw:counturl="<data:blog.url/>" it shows as an error as tw:counturl cannot handle '<' tag. Is there a work around.

The error is as follows The value of attribute "tw:counturl" associated with an element type "null" must not contain the '<' character.


回答1:


Ok I found the answer to it. You have to add a javascript code to handle it.

var tweet_button = document.getElementById(&#39;addthis_button_tweet&#39;);
tweet_button.setAttribute(&#39;tw:counturl&#39;, <data:blog.url/>);



回答2:


This should work, you just need to add "expr" before tw:counturl. I was able to get it working on my Blogger site with the following:

<a class='addthis_button_tweet' expr:tw:counturl='data:blog.url'/>

This needs to be entered into the template itself Template -> Edit HTML -> Proceed.

I hope this works for you.



来源:https://stackoverflow.com/questions/13393829/dealing-with-in-twcounturl-addthis-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!