Choosy has a URL-based API. Opening a specially formatted URL will cause Choosy to spring into action, and send a link to the right browser.
A Choosy API URL looks like this:
The web-url part tells Choosy which Web address it should open, and the api-method part tells Choosy what to do with it.
Here's a real example:
Opening that URL will tell Choosy to prompt you to select from all of your
browsers, and to open
http://georgebrock.com in the browser
||Choosy should decide what to do based on the user's settings.|
||Choosy should prompt the user to select from all of their browsers.|
||Choosy should prompt the user to select from all of their browsers that are currently running (or all of their browsers, if none are running).|
||Choosy should use the user's favourite browser, i.e. the one at the top of their browser list.|
||Choosy should use the user's favourite browser that's already running, i.e. of the running browsers, the one nearest to the top of their browser list. If none are running, their overall favourite will be used.|
Using the API
Exactly how you trigger the API will depend on the programming tools that you are using. To get you started, here are a few examples:
From the Terminal, or in a shell script, you can use the Choosy API via
From AppleScript, you can use the
set choosy_url to "x-choosy://open/http://example.org" open location choosy_url
In a browser, browser extension, or bookmarklet, you can set the window's
var url = "x-choosy://open/http://example.com"; window.location = url;
In a Cocoa application you can use
NSURL *url = [NSURL URLWithString:@"x-choosy://open/http://example.com"]; [[NSWorkspace sharedWorkspace] openURL:url];
Custom API methods
Choosy's rule system allows you to define behaviours that match custom API methods, giving you the power to expand the API in whatever way you choose.
Follow these step-by-step instructions to create a custom API method.