We all know that getting information out via Twitter is helpful to your brand or company, but what if you want to have your website or blog readers do it for you? Or perhaps you want to get a standard message out or include a keyword or two through the use of hashtags (#).

NOTE: As of May 2011, this method no longer works! Please read my NEW post on the new way here.

tweet_chat

The process for doing this is very easy, however I learned a little trick that you can use, especially if you want to use hashtags (which I solve at the end of this post).

Simple Link

The context is very simple. Let’s say the message you want to post is:

“I learned how to pre-populate Twitter statuses at: https://www.hightechdad.com Thanks @hightechdad!”

All that you need to put in for your link is:

http://twitter.com/home?status=I learned how to pre-populate Twitter statuses at: https://www.hightechdad.com Thanks @hightechdad!

Try it by clicking this link –> http://twitter.com/home?status=I learned how to pre-populate Twitter statuses at: https://www.hightechdad.com Thanks @hightechdad!

Linked Text

If you want to make it a bit more elegant, you can put it into link tag and simply link a word or set of words:

<a href="http://twitter.com/home?status=I learned how to pre-populate Twitter statuses at: https://www.hightechdad.com Thanks @hightechdad!">TWEET THIS</a>

Try it by clicking this link –> TWEET THIS

Issues with Hashtags

Hashtags are important in many Twitter messages because that give users the ability to group similar messages together. Let’s say that you are attending “XYZ Expo” and you heard something interesting that you wanted to share with your Twitter followers. By adding a hashing and a keyword like #xyzExpo, you can start “tagging your tweets.” That way, when people click on your hashtag, it will show all tweets that have the same hashtag. It’s a great way to consolidate like tweets and Twitterers.

Normally, in the tweet, you would simply put in the “#” (hashtag symbol). However, when you want to put it into a link like the one listed above, you run into issues. This is because the “#” is used within URLs as an anchor tag. For example, if you want to jump to a particular area within a page, you would add a “#” to the end of the page name as well as tag that section within the page for that anchor link. Say that you have a section called “Details” and you anchor your page there, the link would be “somepage.htm#details”. This is great for in-page navigation but poses problems with the Twitter status linking. If you only include the hashtag, the Twitter server will give you an error, thinking it is looking for a particular anchor on a page that doesn’t exist.

Unfortunately, you can’t use a special “&xxx;” type of code for the # symbol (the way you can with “&” which is “&amp;”) because the translation for the “#” actually CONTAINS the “#” symbol (the special HTML character for a hashtag is “&#35;”which contains a # so it won’t work).

Solution

So, how can you make hashtags work in a pre-populated Twitter status update? Easy, you use a different type of character. And actually, you should do the same for spaces.

The characters:

  • space = %20
  • hashtag = %23

Let’s say you want to pre-populate the message:

“I learned how to pre-populate Twitter statuses with hashtags at: https://www.hightechdad.com Thanks @hightechdad! #cool”

The html code would look like this:

<a href="http://twitter.com/home?status=I%20learned%20how%20to%20pre-populate%20Twitter%20statuses%20with%20hashtags%20at:%20https://www.hightechdad.com%20Thanks%20@hightechdad!%20%23cool">TWEET THIS</a>

Try it by clicking this link –> TWEET THIS

You can also, I believe, eliminate all of the %20’s from your message and simply use the %23 for the hashtag. So, your code would look like this:

<a href="http://twitter.com/home?status=I learned how to pre-populate Twitter statuses with hashtags at: https://www.hightechdad.com Thanks @hightechdad! %23cool">TWEET THIS</a>

Try it by clicking this link –> TWEET THIS

Do note that the user must be logged in or log in to make this work. Obviously they do need to have a Twitter account. They also do have the ability to change the context of the tweet as all that this does is pre-populate the status field on Twitter’s site. I hope you found this useful. It can help your audience to get out tweets easily directly from your site.

HTD says: Twitter is a very useful communication tool. Enabling your users to get your message out easily is critical.

18 Responses

  1. Yeah, it is actually pretty simple. The hashtag was really annoying me so I wanted to figure out a solution. Glad to help!

  2. excellent, i will be using that right away. i see you are the father of 3 girls, so wonderful. I am a father of 4 girls.

  3. If you are not logged into twitter and you click on one of these links you will be prompted to login. Once you login your prepopulated tweet will be broken if you used %23 for a hashtag.

    I don't know of a fix but I am looking for one.

  4. Thanks for the info, I thought that I had tested that. I did test a few times with logged out scenarios. Perhaps I will come up with an answer (or you will).

  5. This is truly a great asset. Makes life so much easier especially during giveaways. Thanks for sharing this

  6. Thanks, Zachary – yeah, my How-to article was from 2009 so a LOT has changed since the original post.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Other articles of interest

Global Product Review Disclosure

Disclosure: This is a global disclosure for product review articles on HighTechDad. It does not apply to Automobile reviews and there are other exceptions. Therefore, it may or may not be applicable to this particular article. I may have a material connection because I may have received a sample of a product for consideration in preparing to review the product and write this or other content. I was/am not expected to return the item after my review period. All opinions within this and other articles are my own and are typically not subject to the editorial review from any 3rd party. Also, some of the links in the post above may be “affiliate” or “advertising” links. These may be automatically created or placed by me manually. This means if you click on the link and purchase the item (sometimes but not necessarily the product or service being reviewed), I will receive a small affiliate or advertising commission. More information can be found on my About page.

About HighTechDad

Michael Sheehan (“HighTechDad”) is an avid technologist, writer, journalist, content marketer, blogger, tech influencer, social media pundit, loving husband and father of 3 beautiful girls living in the San Francisco Bay Area. This site covers technology, consumer electronics, Parent Tech, SmartHomes, cloud computing, gadgets, software, hardware, parenting “hacks,” and other tips & tricks.

Recent Articles

Explore Categories