Bookmarklets, such as SuperGenPass don't have favicons, because they are javascript: links and Firefox doesn't know where it would obtain the favicon from. Is there any way to add a favicon to a JavaScript bookmarklet?

  • I don't think this is possible, but if you find a solution I'd certainly like to know (I have 100's of bookmarklets) – scunliffe Oct 18 '09 at 2:09
  • 2
    None of the answers seems to work anymore. – ashleedawg Dec 17 '19 at 23:28

You can try this trick:

  1. Find a normal link (without JavaScript) for the website with the correct favicon.

  2. Add that link to your bookmarks toolbar as a normal bookmark.

  3. Finally, change the properties of the bookmark you just added and change the location to be the actual JavaScript bookmarklet you want (you want the location from the bookmarklet that doesn't have the favicon).

Now you've turned the bookmark from step 2 into a bookmarklet with the desired favicon and JavaScript.

  • 2
    This doesn't work anymore. As soon as the bookmark's location is changed, the icon updates (which, in the case of a javascript bookmarklet, is the generic "globe" icon) – ashleedawg Dec 17 '19 at 23:04

The Favicon Picker 2 extension will let you do this.

How to Use: Just right-click any bookmark and select "Properties,"
then click "Browse..." to select an icon or paste a URL to an icon.

Bookmarklet icons

Also, you can uninstall the extension when you're done and the icons will remain.

  • Mucks up some other dialogs on Mac, but I was able to install the extension, set an icon, and uninstall it. Is there a way to change this using about:config or the like? – Drew Stephens Oct 19 '09 at 14:58
  • Unfortunately, the extension has been incompatible with the latest version Firefox, at least since May 2015, at most today. – thenonhacker Jul 20 '15 at 5:55
  • Doesn't work any more. Dead link; extension unavailable. – ashleedawg Dec 17 '19 at 23:10

Pelms' suggestion led me to find the possibly-related Favicon Picker 3, which works better on Mac OS X.

  • Works fine for me on Windows 7 x64 too – CAD bloke May 30 '10 at 23:24
  • Not available for Firefox 31 – Chandrayya G K Aug 19 '14 at 5:32
  • Doesn't work any more. Dead link; extension unavailable. – ashleedawg Dec 17 '19 at 23:10

The easiest way is to hijack a bookmark. Just bookmark a page that has a favicon that you want to use. You may need to click on the bookmark to have it load the favicon from the site that it links to. Once you have the favicon, then, go to the bookmark, right click, and choose properties. You can then change the "location" to the javascript code for the bookmarklet you want to have associated with the favicon. Tip: To differentiate a bookmarklet from a bookmark, I change the "name" in the properties tab to whatever preceeded by M:, so for example, if the bookmarklet was for creating a shortened URL using goo.gl, I would name that "M:Goo.gl"

  • 1
    Amigo, is this answer substantively different from the answer by URLParser.com? – Mr.Wizard Jul 1 '12 at 8:11
  • Doesn't work Neither the answer, nor the "tip" have worked, for years. – ashleedawg Dec 17 '19 at 23:07

You can do this with userChrome.css:

  1. Go to about:support
  2. Under "Application Basics", "Profile Folder", click "Open Folder"
  3. If they don't exist, create folder chrome, then file userChrome.css

I use this style:

:root {
  --amber: #FFC000;
  --chartreuse: #B2D733;
  --magenta: #BF1449;
  --teal: #158466;
  --vermilion: #FF4000;
#PlacesToolbarItems image {
  padding-top: 16px;
#PlacesToolbarItems toolbarbutton:nth-child(5n+1) image {
  background: var(--teal);
#PlacesToolbarItems toolbarbutton:nth-child(5n+2) image {
  background: var(--chartreuse);
#PlacesToolbarItems toolbarbutton:nth-child(5n+3) image {
  background: var(--amber);
#PlacesToolbarItems toolbarbutton:nth-child(5n+4) image {
  background: var(--vermilion);
#PlacesToolbarItems toolbarbutton:nth-child(5n+5) image {
  background: var(--magenta);

If you want to use images, you can; just put them in same folder, then link like this:

background: url("something.png");
  • Doesn't work, as far as I can tell. What is it supposed to do? Change the color of every 6th to 10th icon? – ashleedawg Dec 17 '19 at 23:27

Working as of July 2020:

The only reasonable way I found to get a favicon for a javascript: bookmark is by importing it using Import bookmarks from HTML option in the following format (obtained by exporting to HTML):

<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
     It will be read and overwritten.
     DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<H1>Bookmarks Menu</H1>

        HREF="javascript: (function() { if (window[%22_gainNode%22]) { window[%22_gainNode%22].gain.value = parseFloat(prompt('Set the audio gain')); return; } var v = document.querySelector('video'); var audioCtx = new AudioContext(); var source = audioCtx.createMediaElementSource(v); var gainNode = audioCtx.createGain(); gainNode.gain.value = parseFloat(prompt('Set the audio gain')); source.connect(gainNode); gainNode.connect(audioCtx.destination); window[%22_gainNode%22] = gainNode; } )();" 
        Bookmark name
  • Notice that the javascript quotes have to be replaced either with a single quote or %22.
  • Icon should be a base64 encoded png image
  • Ignore the "DO NOT EDIT" line
  • Editing the address / javascript after import will get rid of the icon
  • Editing the name / bookmark folder after import will retain the icon
  • Bookmark will likely not show up in any folder after import, you will have to search for it either with its name or part of href.
  • Save the file as HTML and import it Ctrl+Shift+B>Import and Backup>Import bookmarks from HTML
  • Importing the file will not overwrite any existing bookmarks you currently have, however backup is recommended (just in case)

If you import the given example you will get a volume gain management on videos in any tab using AudioContext. It has a loudspeaker icon and "Bookmark Name" as its name.

  1. Export bookmarks as HTML.
  2. Edit HTML, add ICON="data:image/png;base64,..." to your bookmarklet, i.e.

  3. Import bookmarks from edited HTML.

Works in Firefox as of now.

  • Tried it, it did not work – ctrl-alt-delor Oct 6 '17 at 18:35
  • Doesn't work any more... (HTML tags cannot be used in the bookmark location.) – ashleedawg Dec 17 '19 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.