Quick Search Bookmarklets

Update: I do all this with Ubiquity now.

  • Quick Search: A feature of Mozilla browsers that allows you to store a bookmark with a variable and a keyword, to allow custom searches by typing the keyword and a search term into the location bar
  • Bookmarklets: Bookmarks that, instead of a normal URL, contain small javascript programs

What could be better than these? Combine them together!

In November 2005, I was trying to get rid of the Googlebar extension, since I didn’t use most of its features, and the parts that I actually used could be better met by more specialized, less Google-oriented extensions. For instance, the SearchBox Sync and SearchWP extensions have the same functionality as Googlebar’s terms toolbar, but use Firefox’s native search box and sync with any search engine; not just Google. Google’s translation service could be better met by a dedicated translation extension, like translator, or Translate, the Google cache feature could be replaced by a dedicated cache-viewing extension like any of these: 1 2 3 4 5 6 7 8

But what to do about Google’s site: search? (It lets you search for a term within the domain you are currently viewing.) I couldn’t find an extension to replace this functionality, but it’s a feature that I use regularly, so I couldn’t get rid of the Googlebar quite yet. There’s no way to do this with a Mycroft plugin, as far as I know, since it needs to know the site you’re currently on, in addition to the search term. Likewise, it couldn’t be done with a Quick Search, since the URL it generates only varies by search term; not the URL you are currently visiting. It could be done with a bookmarklet, but the search term would have to be entered into a prompt: popup, highlighted on the page before clicking the bookmarklet, or the like.

So why not use the Quick Search functionality for the search term (%s), the bookmarklet to determine what site you’re on (location.hostname), and the keyword for the interface? So I did. After some work (and several revisions), I use this:

If you drag it to your Bookmarks Toolbar and give it a keyword:

Screenshot of bookmarklet properties

You can then search for a term anywhere within the domain you are currently viewing by doing one of the following things:

  • Enter “site searchterm” into the Location bar
  • Highlight a search term on the page and click the “Site:” button in the Bookmarks Toolbar
  • Highlight a search term on the page and type “site” in the Location bar
  • Click “Site:” in the Bookmarks Toolbar and then type your search term in the prompt() window that pops up
  • Enter “site” in the Location bar and then type your search term in the prompt() window

So many possibilities!

Also, when I first wrote it, I could highlight a word and then select Site: from the context menu using the SmartSearch extension, which allowed me to leave the bookmarklet in my Quick Searches folder and still access it with the mouse without cluttering up my Bookmarks Toolbar. I rarely used this, though, and it appears to have broken; I don’t know if one of my changes broke it or if a change to SmartSearch broke it.

Other search keywords I use:

  • wp: Goes to the shortcut that I typed on Wikipedia. So if I type “wp wotta” it capitalizes it and goes to WP:WOTTA
  • wayback: Goes to the Wayback Machine listing for the page I am viewing (this isn’t actually a Quick Search, since it doesn’t involve any search terms, but I access it by typing “wayback” into the location bar, so I’m using a keyword and bookmarklet at the same time)
  • latest: Goes to the most recent archived copy on the Wayback Machine, like above

Leave a Reply

Your email address will not be published. Required fields are marked *