Err… what’s a Bookmarklet?

A bookmarklet is a bit of JavaScript disguised as a bookmark that, when run, can perform a specific bit of work via your browser.  These below are generally built to satisfy some search need, to make these searches easier, more seamless, and less annoying.  Try one; try them all!

I have tested these and they all work as-is in the latest (2023-01-19) versions of Opera, Chrome, and Firefox.

If you run into trouble, try updating your browser or disabling all extensions before altering the JavaScript.

(If clicking the bookmarklet dialog does not spawn a new tab with your target, I have seen Firefox act a fool and need changed to %27.  But probably check your updates and extensions.)

HowTo:  Install and Use a Bookmarklet

The short version:

  • Triple-click the line of JavaScript code to highlight it.
  • Drag and drop that line of code to your browser’s Bookmarks Bar to create a bookmark.
    • If drag-and-drop doesn’t work, created any bookmark and edit to substitute the js as the destination and name it accordingly.
  • Right-click that newly created bookmark to edit the name.
    • Suggested names are provided above each JS line.  I like to keep the names short so more fit on the bar.
  • Rinse and repeat for all you’d like below.  Or create your own.


Once you have a bookmarklet installed, there are two ways to use it.  You can either highlight any text on the page and click the bookmarklet, or (if no text is highlighted on the page) a search dialog appears when the bookmarklet is clicked.

Of note, iframe contents cannot be seen, only the wrapping page.  In these circumstances a dialog will always spawn.

These are all built to open a new tab, which should open next to (to the right of) your current working tab.

These can be leveraged for many searches one does throughout the day, thus greatly increasing the efficiency of said searches.  I’ve been building and using them since 1999 and will continue to do so.



// GitHub 
// gitH 
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("Search GitHub for… ").replace(/\s\+/g,"%252B");if(q!=null)""+q);void(0); 


// Amazon 
// Amazon+s 
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("Search Amazon for… ").replace(/\s\+/g,"%252B");if(q!=null)""+q);void(0); 


// LinkedIn  
// LI+s 
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("Search Amazon for… ").replace(/\s\+/g,"%252B");if(q!=null)""+q);void(0); 


Adjust URL for your instance.

// Confluence 
// C+s 
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("Confluence [try words]…").replace(/\s\+/g,"%252B");if(q!=null)''+q);void(0); 


Adjust URL for your instance.

// SolarWinds https://YOURINSTANCE/ui/search?q=%s 
// SW+s 
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("SolarWinds [try a sensor number]…").replace(/\s\+/g,"%252B");if(q!=null)'https://YOURINSTANCE/ui/search?q='+q);void(0); 


Adjust URL for your instance.

// ServiceNow ticket search$ 
// SN+s 
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("Service-Now [try a sensor number]…").replace(/\s\+/g,"%252B");if(q!=null)'$'+q);void(0); 

// ServiceNow direct ticket search (no iframe) 
// this takes you to a ticket directly if search results are unique 
// SN+cs 
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("ServiceNow Case Number: ").replace(/\s\+/g,"%252B");if(q!=null)''+q);void(0); 

// ServiceNow knowledge base article search 
// SN+KB 
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("Search for a KB").replace(/\s\+/g,"%252B");if(q!=null)''+q);void(0); 

Under the Hood

As you will note from the JavaScript, each of these bookmarklets performs a variable substitution (here named q) into the URL sent back to the server performing the search.  As such, one would perform any URL substitution.

For example, at one job I was able to create several bookmarklets for accessing various config pages on devices by substituting the device names.

// so if you begin with a URL like  
// you can massage that into a bookmarklet something like  
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("Config X for device…").replace(/\s\+/g,"%252B");if(q!=null)"https://"+q+".company.internal:8834/path/to/configX");void(0); 

The possibilities are pretty limitless.


Leave a Reply

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