See title/question. Nothing more to add.
See title/question. Nothing more to add.
You can explicitly specify the URL you would like to share using the “data-url” parameter, and by omitting the “data-via” param, we will not append the “via @username” in the tweet text.
Hey, thanks. Were you trying to post code to show me, if so… you might have enclosed it with the wrong tags, can’t see it.
Specifying the URL defeats the purpose of wanting to suppress it altogether.
In my testing, omitting the
data-via doesn’t matter. It still automatically appends the username of the logged in user. And since you have to be logged in to Tweet, this is unavoidable.
As a possible workaround I’ve tried placing arbitrary text for the
false for example which works in appearance, but causes wonkiness behind the scenes for the button. Also, placed
data-url which kind of half works.
Either way, there’s really not an ideal solution to create a Tweet button with just the Tweet text outside of asking people to copy/paste a Tweet which of course is no good in our instant gratification culture.
So I guess we can chalk this up as a suggestion for future development? Being able to add
false to hide parts of the Tweet we don’t want included.
Also, if you have a minute, the latest Twitter update rendered this button broken (the only thing that’s special about it is that it’s a PDF URL):
Just to be clear, are you trying to create a tweet button that does not share a url? (the general purpose of the current tweet button is to share URL’s on Twitter).
If you are just trying to create a button that opens a new Tweet popup, I’d suggest looking at the Twitter Tweet Web Intent: https://dev.twitter.com/docs/intents
Or, depending on your use case, you could use some of the new buttons that were just released today: https://twitter.com/buttons
I’ll take a look at your other post, and will follow up regarding that issue on that thread. Let me know if this clarifies some of the issues you brought up.
That is it indeed sir, I need to be looking at intents instead of trying to put a square peg in a round hole.
Great, glad we could help!
I’m facing the same issue using Web intents already. I’m building a link tag containing only the text parameter like this :
My text already contains a url, a message and two hashtags. Unfortunately, the url of the current page is automatically appended to the content of my text parameter.
I would like to be able to set the whole content of the tweet myself.
@leonardmessier - Twitter Web Intents do not require the class “twitter-share-button”, using that class will turn your link into a tweet button (which will include the page url). If you drop the class, but still include widgets.js, then the web intent popup will work as expect.
Let me know if this solves your issue.
Yeah, you’ll have complete control, but the compromise is that you’ll need to design your own Tweet/Retweet graphic or write some CSS.
If it’s just going to be the same text over and over that you want people to Tweet you might want a Retweet button instead:
So, just create the text and Tweet it on your Twitter profile then extract the Tweet ID from it (by right-clicking on the Tweet date and copying the ID or following the link and copying out the ID) and replace
142828511663620097 with your own.
If what you want is different you could still just apply my custom CSS to your button/link:
See demo of the button here:
I can also help you write up some different CSS if you like. The button I’ve designed so far is pretty plain Jane, how I like it. But, I’ll probably write an article on how to utilize CSS3 for feature rich buttons, gradient, shadow, inset text etc.
Thank you both !
@chanian : removing the class definitely worked. Worth mentioning is the fact that I had to urlencode the whole content of the text parameter, otherwise it won’t work but that should be pretty obvious for anyone else than me !
@Bryan : I won’t be handling the CSS myself, but thanks for the tip !
The thing that does the trick is adding ‘?url=/’ to the default ‘https://twitter.com/share’ href. I found this by looking at the doc here:
Thank you! This is awesome.
This was mucho helpful, thanks!