Second Bookmark Bar

Bookmarklets on the bar: what runs, what asks first

The bar on a demo page with the bookmarklet Word count highlighted. In the bottom right corner of the page a message reads Run the bookmarklet Word count on handbook.acme-demo.example? Run only bookmarklets you trust. with a Run button.

A bookmarklet is a bookmark whose address starts with javascript: instead of https:. Clicking it does not open a page. It runs a small piece of code on the page you are looking at, for example to count words or to change how the page looks. Since version 4.1.6, Second Bookmark Bar runs them for you.

The bar on a demo page with the bookmarklet Word count highlighted. In the bottom right corner of the page a message reads Run the bookmarklet Word count on handbook.acme-demo.example? Run only bookmarklets you trust. with a Run button.
The first click on a bookmarklet asks for confirmation. Nothing has run yet.

Where you can click one

A bookmarklet runs on the page you are on when you click it, from any of these places:

  • a button on the bar,
  • a folder menu on the bar,
  • the search box,
  • the Recent and Most used lists,
  • the buttons and folder menus in Classic mode.

Only a real click or key press runs one. A timer or a script cannot start it.

The first click asks

The first time you click a given bookmarklet, a message appears on the page: Run the bookmarklet “Word count” on example.com? Run only bookmarklets you trust. It has a Run button and stays for about ten seconds. If you ignore it, nothing runs.

  • Press Run and the bookmarklet runs. From then on it runs straight away when you click it.
  • If its code changes, the bar asks again. That covers an edit, a change that arrived through sync, and an import.
  • The approvals stay on this device. They are never synced, so on another computer you are asked again.

Bookmarklets that are saved in a private folder do not run.

Where bookmarklets do not run

  • Pages that are not ordinary web pages, such as chrome:// pages, and the extension’s own pages.
  • The Chrome Web Store and the Edge Add-ons store.
  • secondbookmarkbar.com.
  • Sites with a strict security policy. Some sites (a Content Security Policy) tell the browser not to run code like this. The bar cannot get around that. It shows “This site’s security settings blocked the bookmarklet.” and the page itself is not touched.

On a page where bookmarklets cannot run at all, the bar says “Bookmarklets can’t run on this page.”

A few other things stay as they were. Open all as tabs skips bookmarklets, and scheduled bookmarks still open only http and https pages. A bookmarklet’s right-click item Open in new tab does not work, because Chrome refuses to open javascript: addresses in a tab.

The permission, in plain words

Version 4.1.6 asks Chrome for the scripting permission, together with access to http and https sites. The extension uses it to run a bookmarklet you just clicked, on the tab you clicked it in. In version 5.0 it also uses it once, right after a fresh install, to add the bar to tabs that were already open, so you do not have to reload them. It runs nothing else on its own.

The extension never sends or logs the bookmarklet’s code. Keep in mind that a bookmarklet can read and change the page it runs on. That is why the prompt says to run only bookmarklets you trust.

Try it in your own bar

Second Bookmark Bar is free to install, works entirely on your device by default, and takes about a minute to set up.

Add to Chrome — it's free

From the blog

Still stuck? Contact me — I read every message.