How Safari's Look Up Feature Displays Definitions and Info

This article provides a comprehensive overview of the technical mechanisms behind the "Look Up" feature in the Safari web browser. By examining how Safari communicates with the underlying Apple operating system, we will explore how the browser instantly retrieves and displays local dictionary definitions, thesaurus entries, and live Wikipedia snippets within a single pop-up interface when a user highlights a word.

Initiating the Request via WebKit

When you highlight a word in Safari and select "Look Up" from the context menu (or use a three-finger tap or Force Touch on a trackpad), Safari's rendering engine, WebKit, captures the selected text string. Instead of processing the request entirely within the browser, WebKit hands the text string over to the operating system's native frameworks—specifically, the Lookup framework in macOS or the UIReferenceLibraryViewController in iOS.

To provide accurate results, WebKit does not just send the isolated word; it also passes the surrounding sentence or paragraph. This allows the operating system to perform natural language processing (NLP) to determine the word's part of speech and context, ensuring that the correct definition is prioritized.

Retrieving Dictionary and Thesaurus Entries

Once the operating system receives the highlighted text, it queries its built-in Dictionary Services. Both macOS and iOS store compressed dictionary and thesaurus databases locally on the device's storage drive.

  1. Lemmatization: The system first reduces the highlighted word to its root form (for example, changing "running" to "run").
  2. Local Database Query: The system searches the active local files, such as the New Oxford American Dictionary and the Oxford American Writer's Thesaurus, which users can manage in the native Dictionary app settings.
  3. Instant Formatting: Because these files live directly on the device, the definitions and synonyms are retrieved in milliseconds without requiring an internet connection. The system formats this data using internal style sheets and sends it to the Look Up popover window.

Fetching Wikipedia Snippets

Unlike dictionary and thesaurus entries, Wikipedia snippets require an active internet connection and rely on Apple's cloud infrastructure.

When "Look Up" is triggered, the operating system simultaneously sends an encrypted query containing the highlighted text to Apple's Siri Knowledge and Spotlight suggestion servers.

  1. Server-Side Processing: Apple's servers match the query against an indexed database of Wikipedia articles and live Wikipedia APIs.
  2. Data Extraction: The server extracts the title, the introductory summary paragraph, and occasionally a thumbnail URL (though text is prioritized depending on the view) from the relevant Wikipedia page.
  3. Delivery: This data is packaged into a lightweight JSON format and sent back to the user's device.

If the user has disabled "Siri Suggestions" or "Look Up" network access in their system privacy settings, this step is bypassed, and only the local dictionary and thesaurus data will be displayed.

Rendering the Popover Interface

Finally, the operating system aggregates the local dictionary files and the remote Wikipedia data into a unified user interface. The system draws a native popover window directly above the Safari webpage, anchored to the highlighted word. The results are categorized into distinct, scrollable sections—typically placing the local dictionary definition at the top, followed by the thesaurus entry, and the Wikipedia snippet below, allowing the user to consume the information without ever leaving their current web page.