DEV Community

kazi983
kazi983

Posted on

Do You Use This Browser Feature to Search Specific Websites?

Have you ever used this feature?

Chrome has a feature that lets you search specific websites, such as Google Maps, directly from the address bar.

For example, you can register a URL like this in your search engine settings to search Google Maps directly:

https://www.google.com/maps/search/%s?hl=en&source=opensearch
Enter fullscreen mode Exit fullscreen mode

The %s part is replaced with your search query.

In this example, you can type map in the address bar, press Tab, enter your search query, and hit Enter to jump straight to the search results on Google Maps without going through its homepage.

It's a convenient feature that saves a few steps, so I use it quite often. However, while tweaking my settings, I accidentally broke the URL.

How I Found the URL

While trying to find the correct URL, I came across something called OpenSearch.

Here's how I found it:

  1. Open the target website and search for opensearch in the Elements tab of DevTools.
  2. Look for a <link> element with rel="search" and check its href attribute to find the OpenSearch XML file.
  3. Download and open the XML file.
  4. Look for the template attribute inside the <Url> element.

For example, the XML might contain something like this:

<Url
  type="text/html"
  template="https://example.com/search?q={searchTerms}"
/>
Enter fullscreen mode Exit fullscreen mode

The value of template is the search URL template.

{searchTerms} is a placeholder for the search query, so you can replace it with %s or another placeholder depending on the application you're configuring.

Note that not every website publishes an OpenSearch XML file.

I Found Someone Who Maintains a List of These URLs

While looking for the URL, I found Awesome Custom Search Engines on GitHub.

It contains search URL templates for various websites and helped me solve my problem.

I Still Don't Know What This Feature Is Called

By the way, what is this feature generally called?

Chrome's settings call it "Site Search," but I'm not sure what the most appropriate term is when discussing it from a technical perspective.

Would "search engine URL template" be a reasonable term?

If you know the commonly used name for this feature, please let me know!

Top comments (0)