Music Search Bookmarklets

Tools for searching Spotify or other music sites, using whatever text is currently selected

Larry Hamel, May 2024


Often, I want to hear samples from a band that I learn about from a venue website, an email, etc. That might mean typing the performer's name into a Spotify search page. To make this easier, there are now bookmarklets (small javascript snippets that fit into a bookmark) below that will search Spotify or other music services, using whatever text is currently selected in a web browser. I use such tools by selecting the name, and then clicking a bookmark that I previously installed in my browser on my computer.


Try it out now, using a computer (not mobile) by (1) selecting some text on this page, such as the name below, and (2) clicking the "Selected text to Spotify search" link. For example, here's an artist's name that I was happy to learn recently:
Brett Dennen
Selected text to Spotify search

In order for this to work on any text on any web page, one of the bookmarklet links on this page must be saved as a bookmark. (For mobile phones, a bookmarklet *may* work, but are harder to install; see Mobile Phone section below.)

Installation techniques include the following four options; only the last one works for most mobile phones (and is the most difficult technique):

  • Drag this "Selected text to Spotify search" link (or an alternative service link from the list below) into the "bookmarks bar".
  • Or, on Firebox: Right-click on the "Selected text to Spotify search" link and choose "Bookmark Link".
  • Or, via the Bookmark Manager: Use the browser's "Bookmark Manager" to create a new bookmark. In the URL field of that new bookmark, paste in the javascript snippet shown below. The text for the new bookmark is "Selected text to Spotify search" or whatever is preferred in the name.
  • Or, on any browser, including mobile phones: Create a temporary bookmark by bookmarking any normal page, like this page. Then use the Bookmark Manager to edit that bookmark as described above.
For more detailed instruction about bookmarklet installation, consult YouTube Videos or try a web search.

Bookmarklets for searching various music sites

Technical Details

The javascript code is super simple and safe. It does 3 things:

  1. Copy the currently selected text (alert if nothing is selected).
  2. Add that text to the end of the search URL (and encode any spaces/punctuation)
  3. Open a new tab with that URL
The javascript code follows. Note that the bookmarks above have been minified, removing spaces and line breaks which make it easier for humans to read, but longer/worse for computers to download and evaluate.
                            const text = window.getSelection().toString().trim();
                            if (!text) {
                                alert('Please select some text before running this bookmark');
                            } else {
                                const url = '' + encodeURIComponent(text);
                      , '_blank', 'noopener, noreferrer');

Each of these services have a search URL. Some of the services seem to prefer encoding a space character as "+" versus "%20", and some, like Spotify, seem to have different search URLs for computer vs. mobile.

  • (on computer), (on mobile)

Mobile Phones

Mobile phones are challenging for bookmarklets. Some of the bookmarklets above work on some phones, and not others. For example, Chrome on Android is 100% failure as of the publishing date because the selection of text gets cleared when trying to select a bookmark. iPhones/iOS seem to be ok, although Spotify seems to want a different search URL for iPhones versus computers. One key reason for lack of mobile support for this kind of bookmarklet is the touch interface on mobile versus mouse/keyboard on computers.