This Week's Sponsor:

Listen Later

Listen to Articles as Podcasts


Due Clipper For Google Chrome

When there are no actual news or notable app releases, I prefer investing my time in creating something for other people.

Continuing my ongoing series of tips on iOS URL schemes, here’s an adaptation of my existing Due bookmarklet to work better with Google Chrome for iOS (which, as I’ve pointed out several times, has a very nice URL scheme). The following code (to install it, simply copy it and paste the entire string into a bookmark) grabs a webpage’s title and URL and sends them to Due (also powered by a great URL scheme).

Thanks to x-callback-url, we can specify URLs to open in case of “error” (Due couldn’t create a new reminder) or “success” (Due created a new reminder and automatically showed the “Reminder” entry screen). In case of error, I personally decide to stay in Due; if the bookmarklet succeeds, I like to be taken back to Google Chrome after I tap the Add button.

javascript:window.location='due://x-callback-url/add?title='+encodeURIComponent(document.title)+'%20'+encodeURIComponent(document.location.href)+'&x-source=Google%20Chrome&x-error=due%3A%2F%2Fx-callback-url%2F&x-success=googlechrome%3A%2F%2F'

As you can see above, in the x-success parameter I’m using googlechrome%3A%2F%2F – which is simply the encoded version of googlechrome:// (those scary characters give it the convenient name of percent-encoding). You can play around with encoding and decoding strings using tools like this. Because x-callback-url’s fields want encoded strings, I’m doing the same with due%3A%2F%2Fx-callback-url%2F and Google%20Chrome. Not encoding strings properly is one of the most common mistakes I kept making when I first started using x-callback-url.

(Question: Why am I using googlechrome:// instead of a full webpage URL? As far as I know, the URL scheme alone can’t reload an existing tab, even when relaunching the same URL (unlike Safari). Therefore, to simply “jump back” to Chrome, I, well, re-open Chrome.)

A note about the screenshot in this post: the dialog box is generated by Due using x-source – a parameter to give a friendly name to the “calling app” (in our case, Google Chrome). Unfortunately, though, we can’t give x-error and x-success different pretty names; both parameters will use the x-source name given in Due. That’s why, even if you want to launch Due, the dialog box will keep saying “Google Chrome”.

Interestingly, the bookmarklet works on Safari for Mac, but not on Chrome (obviously, you won’t be able to rely on x-callback-url on the desktop). You can read more about Due’s URL scheme here, and check out a quick demo video of the bookmarklet below.

Unlock More with Club MacStories

Founded in 2015, Club MacStories has delivered exclusive content every week for over six years.

In that time, members have enjoyed nearly 400 weekly and monthly newsletters packed with more of your favorite MacStories writing as well as Club-only podcasts, eBooks, discounts on apps, icons, and services. Join today, and you’ll get everything new that we publish every week, plus access to our entire archive of back issues and downloadable perks.

The Club expanded in 2021 with Club MacStories+ and Club Premier. Club MacStories+ members enjoy even more exclusive stories, a vibrant Discord community, a rotating roster of app discounts, and more. And, with Club Premier, you get everything we offer at every Club level plus an extended, ad-free version of our podcast AppStories that is delivered early each week in high-bitrate audio.

Choose the Club plan that’s right for you:

  • Club MacStories: Weekly and monthly newsletters via email and the web that are brimming with app collections, tips, automation workflows, longform writing, a Club-only podcast, periodic giveaways, and more;
  • Club MacStories+: Everything that Club MacStories offers, plus exclusive content like Federico’s Automation Academy and John’s Macintosh Desktop Experience, a powerful web app for searching and exploring over 6 years of content and creating custom RSS feeds of Club content, an active Discord community, and a rotating collection of discounts, and more;
  • Club Premier: Everything in from our other plans and AppStories+, an extended version of our flagship podcast that’s delivered early, ad-free, and in high-bitrate audio.