Web Intents don't seem to shorten URLs to t.co


I’m using a tweet web intent to post a string of text and a URL using the text and url parameters (both URL-encoded). In the documentation, the expected result is that the URL is automatically shortened using t.co and this doesn’t seem to be the case.

In the section titled Supported Parameters.

In the example given, the link isn’t shortened (and the second example intent is actually broken).


The links will be wrapped with t.co after submission – are you sure they’re not being wrapped after submission?


The popup won’t allow me to submit, as the length of the tweet is greater than 140 characters (I receive feedback to this effect if I click submit).
I’m also not seeing the message about links being shortened.


Ah, I see now. Even with the link shortened to 19 characters, the total length of the tweet was still over the limit of 140. I think I was confused because there wasn’t any indication that the link would be shortened.

Thanks for the help.


What’s an example of the data-url and data-text you’re presenting?


I was under the impression that web intents just rely on the href of the anchor tag, not data attributes. (again, see the first few examples here: https://dev.twitter.com/docs/intents).

An example of what I’m doing:



You can use either approach pretty interchangably.

In this case the URL is being wrapped by t.co in the calculation – the HTTP-based link is accounting for 20 characters of the character count.

“Lorem ipsum dolor sit amet, consectetur adipiscing elit. In posuere ornare tellus, id laoreet orci volutpat eu. Duis rhoncuss” accounts for 125 characters.

Together the output accounts for 145 characters instead of 140, and could be thought of as something more like: “Lorem ipsum dolor sit amet, consectetur adipiscing elit. In posuere ornare tellus, id laoreet orci volutpat eu. Duis rhoncuss http://t.co/XXXXXXXX


Yep. I was sort of alluding to that above with my “I see now…” post :slight_smile:
It is still odd to me that the tweet prompt doesn’t display the “URL will appear shortened” message that the normal “Compose Tweet” lightbox on twitter.com does. I think that’s what was throwing me off.

Thanks again.



I am also sticking with the shorten URL issue.

I am trying to send ‘data-text’ and ‘data-url’ attribute values in the anchor tag. And both these values are normal form not encoded. Then when I click the tweet button, a pop-up is opened, and in the pop-up box, text is coming fine, but the URL is not shortening.

Even after submitting the tweet, when you see tweets in your account, here URL is still not shorting . I also tried by passing the encoded data-url, but in this case the URL was not displaying in the pop-up box.

Please help me out, how can I shorten the URL value in the tweeter pop-up or on tweet listing page in account.

Thanks in advance…