A Bookmarklet for Confining Google Search Results to a Specific URL

Main image for A Bookmarklet for Confining Google Search Results to a Specific URL

We were looking for a simple way to search a web site from a specific path, not just from the root. For example, www.strava.com/athletes. Google supports this by using the syntax "site:https://www.strava.com/athletes {search_term}", but rather than have to type that in each time, I created a bookmarklet that does the same thing, and more.

  1. Go to the page you want to search from.
  2. Click the bookmarklet you installed from below.
  3. Enter your search term at the prompt.
  4. From the Google results page, you can click the bookmarklet again to change the search term: no need to go back to the prior page.

Bookmarklet Code