Launch Bookmarklets with the Keyboard in Chrome

I use a lot of bookmarklets. They’re great for all sorts of tasks… but they have some drawbacks. First, they can eat up space on your bookmarks bar. To add insult to injury, Chrome offers exactly one option to customize the favicon: the blank page… which means you better name them and use more valuable space on your bookmarks bar. And you have to use the mouse to activate them. You can nest your less-used bookmarklets in folders to solve the first issue, but what about keyboard shortcuts?

There is an easy way to create keyboard shortcuts to bookmarklets (and websites) and it’s all built into Chrome without the need for extensions.

Let’s assume we have an existing bookmarklet on our bookmarks bar, and we’ll convert it to a keyboard shortcut and free up some space. For this example we’ll use a bookmarklet called “SiteSearch”. It searches the current site for any selected text, and with no selection it presents a prompt to enter your own site search terms.

site_search
If you want to play along at home, you can create your own SiteSearch bookmarklet by selecting all the code below, then dragging it to your bookmarks bar.

javascript:(function(){var%20s=window.getSelection().toString();if(s){var%20i=s;}else{var%20i=prompt('Search%20Site:%20%20'+location.hostname,'');}if(i==null){return;}else{u='https://www.google.com/search?q='+encodeURIComponent(i)+'%20site:'+location.hostname;}window.open(u);})();
  • Right click on the bookmarklet and select Edit to show this:

Edit_Bookmarklet

  • With the Name field highlighted, hit tab to move to the URL field.
  • With all the code in the URL field selected, copy it to the clipboard.
  • Hit Cancel to close the edit form.
  • Right Click on Address Bar and select Edit Search Engines.

EditSearchEngines

  • Scroll to the bottom of “Other Search Engines” until you see three empty boxes.

Other Search engines

  • Enter the bookmarklet name, SiteSearch in the first box
  • Enter a keyword shortcut. In this case, I use ss because it’s fast to type.
  • Paste the bookmarklet code into the URL box.
  • Press Done, because.. well, you’re done.

How to use it:

  • Press Alt+D (or Ctrl+L) to highlight the address bar
  • Type your keyword ss. The first match will be the bookmarklet name.

bookmarklet_address

  • Press Enter. Boom! You just activated your SiteSearch bookmarklet with keyboard.