2

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”

  • I don’t think that it can. When I was researching URLs for launching a man page (x-man-page://). I don’t recall seeing anything for the dictionary. – Allan Jul 28 at 7:06
  • Thinking further, if it uses http/https, you may be referring to Universal Links that allows web developers to open associated apps with their links; like the App Store, Reddit, Imgur, etc. – Allan Jul 28 at 7:14
  • It doesn’t use http(s). Those are protocols for talking to a web server. I’m looking for a way to interact with Dictionary.app – WGroleau Jul 28 at 7:28
  • I know that, I’m not sure why you’d think I wasn’t aware of what http/https was for. I was asking if they were links because of the last sentence in your question: ¹the first part of the URI—in a web link, the protocol is “http” or “https” which of course is a footnote to your reference to protocols. This is why I posted two comments - it’s not clear which direction you’re going in; the specific protocol or the universal link. – Allan Jul 28 at 7:47
  • 1
    You can do e.g. <a href="dict://foobar">Lookup 'foobar' in Dictionary</a>, however, it will open it in the Dictionary to whichever was last selected when it was closed. It also pops up the Do you want to allow this page to open “Dictionary”? you'd have to respond to. – user3439894 Jul 28 at 14:23
0

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.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .