Second Bookmark Bar

Bookmarklets in Chrome: How to Add, Run and Trust Them (2026)

You found a bookmarklet that counts the words on a page, or tidies up a messy site, and you want it on your bar. Or you added one and it does nothing. This post covers how to use bookmarklets in Chrome: how to add one, why it fails on some pages, and how to decide whether to trust it.

I tested the Chrome points below in Chrome 157 on Windows 11, on 2026-11-10.

What a bookmarklet is

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.

MDN, the web documentation Mozilla maintains, describes javascript: addresses as acting like links that run code instead of going anywhere (MDN). The same page warns that they can run arbitrary code, which is the whole point of a bookmarklet and also the reason to be careful with one.

Add one to Chrome

The easy way: drag it. Some bookmarklet pages give you a link to drag. Drag that link from the page onto Chrome’s bookmarks bar and let go. I tried it on 2026-11-10: the bookmarklet landed on the bar under the link’s text and ran when I clicked it. It worked the same in Brave.

When you only have the code: use the Bookmark Manager. Do not paste the code into the address bar. When I pasted javascript:alert('pasted') there, Chrome kept only alert('pasted') and dropped the javascript: part. People reported the same thing as far back as 2011 (Stack Overflow). The Bookmark Manager does not:

  1. Open the Chrome menu, then Bookmarks and lists, then Bookmark Manager.
  2. Open the manager’s menu and choose Add new bookmark.
  3. Give it a name.
  4. Paste the code into the URL box. In my test the javascript: part stayed, and the saved bookmarklet ran from the bar.
  5. Save. To have it on the bar, add it while the Bookmarks bar folder is open.

Google’s help page confirms the Bookmark Manager path (Chrome help).

Then open any ordinary page and click the bookmark.

Why nothing happens on some pages

If the bookmarklet worked on one site and does nothing on another, there are two usual causes.

The page forbids it. Some sites send a Content Security Policy, a header that tells the browser which scripts may run. MDN’s guide says a strict policy disables inline JavaScript (MDN), and its page on javascript: addresses says they can be blocked by the policy’s script-src rule. A bookmarklet is inline code, so a strict site can stop it. There is no setting on your side that changes that, and it is a choice the site made.

It is not an ordinary page. Chrome does not run bookmarklets on its own pages. I clicked a word-count bookmarklet on Chrome’s bar while on chrome://settings, the New Tab page and chrome://version. Nothing happened on any of them: no message, no error, the page unchanged. Brave behaved the same on its brave:// pages.

Two quick checks when one fails: try it on a plain page such as an article, to see whether the bookmarklet itself works, and look at whether the failing site is a web app with strict security.

Read it before you run it: a 30-second check

A bookmarklet runs with access to the page you are on. On a page where you are signed in, it can read what the page shows and change it. So read the code before the first run. You do not need to be a programmer for this pass:

  1. Is it short? Most useful ones are one or two lines. A very long, unreadable blob is harder to trust. Ask for the readable version, or skip it.
  2. Does it send anything out? Search for fetch(, XMLHttpRequest, sendBeacon, new Image and .src=. Those are the usual ways to send data to a server. A word counter has no reason to contain any of them.
  3. Does it load more code? Look for createElement('script') or a web address after src. If it loads a script from somewhere else, you are trusting that other place too, and it can change later.
  4. Does it touch things it does not need? A tidy-up bookmarklet has no reason to mention cookie, localStorage or password fields.
  5. Do you know where it came from? A bookmarklet from a page you cannot identify is not worth it.

If you cannot read it, do not run it. None of these checks is a guarantee. They catch the common bad cases.

Bookmarklets on a second bar, with a confirm step

Second Bookmark Bar runs bookmarklets from its row, from version 4.1.6. I built it, so weigh this accordingly. It is free, there is no account, and it works in Chrome and Brave. The full details are in Bookmarklets on the bar. In short:

  • The first click asks. 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.
  • After you press Run, that bookmarklet runs straight away when you click it.
  • It asks again if the code changes, for example after you edit it or it arrives through an import. The approvals stay on that device.
  • It tells you when a site blocks it. On a strict site, the bar says the site’s security settings blocked the bookmarklet, and the page is untouched.
  • Bookmarklets in private folders do not run.

The prompt exists because a bookmarklet is code, and code that arrives with a backup or an import should not run by surprise.

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.

The permission it needs, said plainly

To run a bookmarklet you just clicked, the extension needs Chrome’s scripting permission, together with access to http and https sites. It uses that permission to run the bookmarklet on the tab you clicked it in. The extension does not send or log the bookmarklet’s code. What a bookmarklet does on the page is up to its own code, which is why the check above matters. The 5.1.0 manifest also declares a separate permission, declarativeNetRequestWithHostAccess, for one rule on the extension’s own YouTube preview requests. It has nothing to do with bookmarklets. I explain every permission in Is Second Bookmark Bar safe? and in the extension permissions audit.

What changed in version 5.x

Dated 2026-11-12. Bookmarklets have run on a click since 4.1.6, with the first-click Run prompt described above. If a bookmarklet seems to do nothing on one site, check whether the bar is hidden there: hide the bar on specific sites lists where the bar can be switched off, and the bar isn’t showing checklist covers pages where it never runs. If you open bookmarks in a new tab by default, that switch does not apply to bookmarklets, which run on the page you are on.

Four harmless ones to start with

These are short enough to read in a few seconds, and none sends anything anywhere. On 2026-11-10 I put each on Chrome 157’s own bookmarks bar, clicked it on a local test page, and checked that it did what it says. All four worked, and they also worked from Brave’s bar.

Count the words on the page

javascript:(()=>{const n=(document.body.innerText.trim().match(/\S+/g)||[]).length;alert('Words on this page: '+n)})()

It counts the text the page shows and says the number.

Zoom the page body

javascript:(()=>{document.body.style.zoom=document.body.style.zoom==='1.25'?'1':'1.25'})()

It makes the page body bigger, and a second click puts it back. It is a quick way to read a page with small print.

Let pinned headers scroll away

javascript:(()=>{document.querySelectorAll('*').forEach(e=>{const p=getComputedStyle(e).position;if(p==='fixed'||p==='sticky')e.style.position='static'})})()

It turns fixed and sticky elements into ordinary ones, so a header stuck at the top scrolls away with the page. Some sites will look odd afterwards, and a reload undoes it.

Edit the page text

javascript:(()=>{document.designMode=document.designMode==='on'?'off':'on'})()

It makes the page text editable, so you can tidy it before printing. Reload to go back. Nothing you change is saved to the site.

What this does not do

  • It does not make a bookmarklet safe. The prompt, or your own check, is what stands between you and a bad one.
  • It does not beat a site’s security policy. If a site blocks inline code, the bookmarklet is blocked there too, with or without an extension.
  • It does not work on browser pages. The extension cannot run on chrome:// pages or on the Chrome Web Store.
  • Chrome’s own bar is enough if you have one or two bookmarklets and click them yourself. The extension adds a confirm step and a place to keep a larger set on a row of their own. If you are a developer who keeps a set of them, the developer’s bookmark setup shows one way to organize it.

Try it

Add the word counter to Chrome’s bar by hand first, using the steps above, and run it on an article. If you start to keep several, a row of their own is the tidier place. The install guide takes a few minutes, and Classic mode gives you a plain row to drop them in.

Questions people ask

How do I add a bookmarklet to Chrome?

Drag the bookmarklet's link onto the bar if the site offers one. Otherwise open Chrome's Bookmark Manager, add a new bookmark, give it a name, and paste the code into the URL box. Do not paste it into the address bar: in Chrome 157 that removes the javascript: part.

Why does my bookmarklet do nothing on some websites?

Some sites send a Content Security Policy that tells the browser not to run inline code, and a bookmarklet counts as inline code. The site then blocks it. Chrome also does not run them on its own pages, such as chrome:// pages and the New Tab page.

Are bookmarklets safe?

A bookmarklet runs with access to the page you are on, so it is only as safe as its code. Read it before you run it, and run only ones from a source you trust.

Does Second Bookmark Bar run bookmarklets?

Yes. The first click on each bookmarklet shows a Run button, and nothing runs until you press it. It asks again only if the bookmarklet's code changes.

Try it in your own bar

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

Add to Chrome — it's free