Reputation: 1467
I followed the twitter share API - normal text from here
https://dev.twitter.com/web/tweet-button
Tried this
Button twitterButton = new Button();
twitterButton.setHTML("<a href=\"https://twitter.com/intent/tweet?text="+tab.getUrlHeader()+" data-size=\"large\"> <img src=\"img/social/twitter.png\" > </a>");
But on button click nothing pops up or happens.
Do i need to add any click handler on button ..?
any help is appreciated ..
Upvotes: 0
Views: 127
Reputation: 2156
I don't think you need to create a Button for this. But just a HTML element.
HTML twitterButton = new HTML();
twitterButton.setHTML("<a class=\"twitter-share-button\" href=\"https://twitter.com/intent/tweet?text="+tab.getUrlHeader()+"\" data-size=\"large\" target=\"_blank\"> <img src=\"img/social/tweet.jpg\" > </a>");
Note that I also find the actual html you are using a little bit strange ? You are never using class="twitter-share-button" although on the link you provide the first thing they say is : Create a new anchor element with a twitter-share-button class...
Upvotes: 2