Open Twitter/ profiles from Safari in your favorite client

You’re browsing Safari and find a Twitter profile that sparks your interest. You visit it and get a prompt to install the Twitter official app. You may have it, however, chances are that if you’re reading this, you use Tweetbot. You memorize the Twitter handle, open Tweetbot, tap search, type the user name and you’re finally there. What if we could build a bookmarklet for this?


Most of that bookmarklet is straightforward, what you may want to know is that, while in a Twitter user page, location.pathname grabs the handle preceded with a slash. If you're checking my Twitter user, it would send /Pgruneich to Tweetbot. The slash allows us to skip the one after user_profile in Tweetbot's url scheme.

But what if you want to go straight to a mention to the user? You can't mention with a slash, so we're going to skip that.


I bet you're already have some url encoded characters on the top of your head, so you can identify the at sign (%40). But what about that substring(1)? We're telling the parameter to start our pathname from the index 1, remember it starts counting in 0, so our index 0 is the slash, meanwhile our index 1 is the first character from the user handle.

But what about some love? We're just modifying the url scheme. You can't automatize to open a profile in Riposte because it requires the user's numeric ID. You can, however, still jump straight to the mention:


Felix is a little more flexible and supports the user handle with the '@' prefix. You can open a profile in Felix with this bookmarklet:


Or mention the user with:


But you don't want to clutter your bookmarks with all these, you may prefer a Launch Center Pro approach.

javascript:window.location='launchpro://?url='+encodeURIComponent('launchpro://?url=[list:Open '+location.pathname.substring(1)+'|Mention on Tweetbot=tweetbot:///post?text=%40|Open on Tweetbot=tweetbot:///user_profile/|Mention on Riposte=riposte://x-callback-url/createNewPost?text=%40|Mention on Felix=felix://compose/post?text=%40|Open on Felix=felix://user/@]'+location.pathname.substring(1))

Now you have everything covered, Tweetbot, Riposte and Felix. You say you use Twitterrific? You can easily include it based on its url scheme, may that be your weekend challenge. Happy stalking!