16.4.12

Firefox Keywords + Javascript = Magic!

Here is something particularly useful that I keep rediscovering for various reasons. Firefox allows you to refer to any bookmark with a keyword, and use that keyword as a shortcut in the address bar to access it. For example, if I create a bookmark that points to "http://www.google.com", and go to "Show all Bookmarks", and click on that bookmark, then I can modify the "Keyword" field, and I will then be able to simply type "google" in the address bar and go there. This has been in Firefox since a very early version.

This gets cooler in that you can easily set up these keywords to actually bookmark search services that will then take a search string following the keyword and redirect you to the search results.

From a Bioinformatics perspective, I could set up a custom search on the UCSC Genome browser that uses this string as the location:

And then give this bookmark the keyword "ratgenome". I could then search for genes in the Rat genome from the Firefox address "ratgenome 'genename'". For example, I could do the query 'ratgenome brca1' to search for "brca1" in Rat.

Now, how often do you look in just one place for something though? What if I wanted to search NCBI's gene database, Ensembl, GeneCards, and UCSC Genome browser? Now we create a simple javascript command, and save that as our bookmark with a keyword:

If I supply the keyword "genesearch", now I can simply do "genesearch brca1" and have all four windows open as tabs with my search results. This can be set up for almost any site as long as you can figure out what the search string parameters are, replacing the part of the URL that defines your query with "%s".

Inspiration from here.

2 comments: