SafariKeywordSearch


Safari Keyword Search is a simple extension for Safari on macOS and iOS that lets you change the default search engine and search using any search engine using keywords in the address bar. For example, you can search Wikipedia for information on monkeys by typing w monkeys in the address bar.

The following searches are included in the default set:

You can also add your own searches in the extension settings, which live inside Safari.

Weird details/limitations etc

This is how the extension works:

  1. Listening for the beforeNavigate event
  2. Checking the URL to see if the domain matches one of the default search domains in Safari (Google, Bing, Yahoo, DuckDuckGo or Ecosia
  3. Extracting the search string from the URL
  4. Checking if the search string includes one of the keywords
  5. Quickly replacing the URL of the tab with the new search URL

Parsing the URL to get the search string is not optimal, but it’s the only way with the current APIs. These edge cases/bugs can occur:

The previous previous Safari Extension API had a beforeSearch event that was a lot more convenient. To any Safari developers who might be reading this: hello!

Privacy policy

Created by Arne Martin Aurlien | View on GitHub | Questions, support? Send me an email