im going crazy , im not so good on js or html so plz try to help me. on my blog on blogger i want to 1) Automatically create a short link using goo.gl service 2) share this short link on twitter by its button the js code im using to make the link short
<script type="text/javascript">
var shorturl;
var longUrl="http://*****" + "<data:blog.url/>";
var request = gapi.client.urlshortener.url.insert({
'resource': {
'longUrl': longUrl
}
});
request.execute(function(response)
{
if(response.id != null)
{
shorturl=response.id;
}
else
{
shorturl="<data:blog.url/>";
alert("error: creating short url n"+ response.error);
}
document.getElementById('shorturlid').setAttribute("data-url",shorturl);
});
</script>
the code for twitter button
<a href="https://twitter.com/share" class="twitter-share-button" id="shorturlid" data-via="*****" data-size="large" data-count="none" data-hashtags="*****">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
this just share the current page url so it seems that my code does nothing.
Any Solution?