Posted: 17 May 2013
Back in January I went on a quest looking for a good way to open gmail URLs on iOS. At first the attempt focused on doing it in the browser but for some reason the url scheme used by desktop GMail is completely different from that used by the mobile versions, and is not consistently portable. That led to the app. Finding its URL scheme was relatively easy thanks to the fact that iOS will let any new application register a url handler for any url scheme. Replace GMail with a url grabber of my own and we’re in business. Unfortunately, there was no scheme to directly access messages, or at least none I could think of worked.
Now though Google, in their constant quest to integrate themselves ever deeper into my iPhone, has released an updated version of GMail which directly opens links in Google Chrome, Maps, and YouTube. Just this in and of itself is not particularly interesting, since each of these has a reasonably simple and for the most part documented URL scheme. The interesting part is that the Google Chrome scheme allows applications to specify callback URLs, and GMail uses this feature. More interesting is that if you open a link in GMail to launch Chrome, go back to GMail without using the callback button in Chrome, select another email, go back to Chrome and use the callback, GMail opens with the email containing the link selected.
GMail has a direct-reference scheme for individual messages, and it has to send it to Chrome in plaintext to make it work. Jackpot!
Using the same trick as before, except this time replacing Google Chrome with a URL Grabber, opening a link in GMail pops out a nice little URL like this.
Ok, maybe not so little after all. Still, documented and relatively simple. What it really boils down to is this.
Chrome-callback: Source=Gmail URL to open=http://tom.scogland.com Callback URL=googlegmail:///cv=13eafcee7cc82901/accountId=1&create-new-tab
Note the new
cv=... syntax on the googlegmail url. New and absolutely
perfect. It just so happens that the value which goes there is exactly the
same as the value in a normal GMail direct message link like this.
The end result is that it’s not just possible but easy to create links directly to GMail emails that work on iOS. Not only that, but the pertinent information to create the link is the same as for the desktop. No more fumbling around with searches to get the email for my OmniFocus tasks when I’m on the phone! Enjoy, and please share if you find something cool to do with it.blog comments powered by Disqus