I am getting "SHARETHIS is undefined" in a page where I used ShareThis social bookmarking utility. Here is my code
<HTML>
<HEAD>
<TITLE>Demo</TITLE>
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher:'f5b1585e-488a-403c-8b7e-ade3efab880a'});</script>
</HEAD>
<BODY>
<span class='st_sharethis' displayText='ShareThis'></span>
<script type="text/javascript">
SHARETHIS.add开发者_运维技巧Entry({
url:'http://www.google.com'
}, {button:true} );
</script>
</BODY>
</HTML>
Can anyone please tell me what could be the problem and how to resolve?
Thanks, Amit Patel
I inspected the DOM using Firebug. No variable named SHARETHIS
. However, there is a variable named stWidget
which has a function addEntry
. I replaced SHARETHIS
with stWidget
and there were no errors. I dont know the correct behavior of the widget, but there is no error.
EDIT: Changed the code to share google.com instead of current url.
<HTML>
<HEAD>
<TITLE>Demo</TITLE>
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher:'f5b1585e-488a-403c-8b7e-ade3efab880a'});</script>
</HEAD>
<BODY>
<span class='st_sharethis' st_url="http://www.google.com" st_title="Google" displayText="Share This"></span>
</BODY>
</HTML>
精彩评论