MacOS – Can MacOS Dictionary be invoked by a URI

dictionarymacos

I've seen links in web pages on MacOS and IOS that invoke other apps, notably App Store and iBooks. If I recall correctly, they usually have a protocol¹ that in some way identifies the app.

I am using an HTML/PHP/MySQL app called Learning With Texts that allows it to create a URI to a web page with place holders to auto-insert a word to look up in an online dictionary. Now I know that ⌘⌃D can be used on MacOS to display all instances of a string that appear in any MacOS dictionary. I am wondering whether there is a URI syntax that will look it up in a specific dictionary. (And what is that syntax.)

In Catalina, if that matters.

¹the first part of the URI—in a web link, the protocol is “http” or “https”

Best Answer

Can MacOS Dictionary be invoked by a URI?

Yes: dict://

Example HTML code: <a href="dict://foobar">Lookup 'foobar' in Dictionary</a>

Tested with Safari under macOS Catalina using:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>Dictionary Lookup</title>
  </head>
  <body>
    <p><a href="dict://foobar">Lookup 'foobar' in Dictionary</a></p>
  </body>
</html>

When clicking the hyperlink, one is presented with:

Do you want to allow this page to open “Dictionary”?


I am wondering whether there is a URI syntax that will look it up in a specific dictionary. (And what is that syntax.)

If there is, I do not know it and I tried modifying dict:// adding the different tabs in the Dictionary app and none worked.

The only thing that worked was dict:// and dict:// followed by the search word, e.g. dict://foobar and in the case of the later syntax it open to the last active tab of the app. For example, if Wikipedia was the active tab when the app was closed it opens e.g. foobar there.