All posts
1 min read

Making a "Send to 2Do" Safari bookmarklet

On this page

Drag the link below onto your Favorites Bar. The default click behaviour simulates navigation on the current page, and the destination URL is whatever you put after javascript:window.location — which in this case is just the target app’s URL scheme. You can look up most apps’ URL schemes at AppTalk.

2Do

Send to 2Do

Then edit the address and replace it with:

javascript:window.location='twodo://x-callback-url/add?task='+encodeURIComponent(document.title)+'&note='+encodeURIComponent(window.location)+'&action=url:'+encodeURIComponent(window.location)

Change Value

So really it’s just a snippet of JavaScript that picks up the current page’s context and hands it off to the URL scheme. Specifically:

  1. document.title — the page title
  2. window.location — the page URL

Things

Things’s URL scheme looks like this:

/// add a todo due when tomorrow
things:///add?title=iamtitle&notes=iamnotes&when=tomorrow

Add a todo to Things

So a Send-to-Things variant becomes:

javascript:window.location='things:///add?title='+encodeURIComponent(document.title)+'&notes='+encodeURIComponent(window.location)+'&when=today'

OmniFocus

Same idea for OmniFocus:

javascript:window.location='omnifocus:///add?note='+encodeURIComponent(window.location)+'&name='+encodeURIComponent(document.title)

Add a todo to OmniFocus

Or just grab the pre-baked link from OmniFocus’s own page and drag it onto the Favorites Bar.

If you can’t see the Favorites Bar, click the Safari menu’s View entry to enable it (called “视图” on Chinese systems).

Favorites Bar