Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter auto shorten URL not working

I am trying to add custom tweet button to my website and all is well but it is not shortening the URL. I am using URL query string instead of javascript. Is that the case?

<a class="btn btn-tweet" target="_blank" href="https://twitter.com/share?text='.$title.'&url='.$url.'&via='.$user.'&wrap_links=true">Twitter</a>

I have read some API document and saying above 19 characters twitter shorten url itself. Just wonder why it is not converting with this.

I am also having trouble to open in popup instead of new window. Does this all possible without adding any separate javascript code but directly inline in anchor tag?

like image 271
Code Lover Avatar asked Jan 02 '14 18:01

Code Lover


People also ask

Does Twitter automatically shorten URL?

Links shared on Twitter, including links shared in Direct Messages, will automatically be processed and shortened to an http://t.co link. Learn how to shorten links. Please note: anyone with a t.co shortened link will be able to navigate to the destination URL.

How do you make a URL shorter on Twitter?

How Do I Use Twitter Link Shortener? You use t.co whenever you post Twitter links. Simply copy and paste a URL into a tweet, reply, or DM, and t.co will automatically convert it into a link of 23 characters or less. This helps keep your tweets under the character limit so you can add more to your post.

How do I permanently shorten a URL?

You can shorten a URL by using an URL shortener website, which will shrink your URL for free. Popular link shorteners on the internet include Bitly, TinyURL, and Rebrandly. You'll need a premium account on these sites to unlock the full range of link customization options.

Can I use bitly links on Twitter?

The Bitly platform allows you to connect to your Twitter account to share links right in your Tweets.


1 Answers

I was hung up on this and realized I was trying to shorten "http://localhost:5000/blog/url" which t.co is unable to do.

Change to a real, non-localhost URL and it worked fine.

like image 136
James Gentes Avatar answered Oct 05 '22 01:10

James Gentes