Bookmarklet Not Working? 9 Fixes
You clicked the bookmarklet and nothing happened. Or the page went blank, or a word replaced the whole site. Bookmarklets fail for a small number of predictable reasons, and most take seconds to fix. Work through this list in order. The first few cover the vast majority of cases.
Before you start, open the browser console (F12, or Cmd+Option+J in Chrome on Mac and Cmd+Option+C in Safari) and click the bookmarklet again. A red error message there usually points straight at the right fix.
1. The bookmarks bar is hidden, so the drag never worked
You cannot drop a bookmarklet onto a bar you cannot see. If you dragged the button somewhere and nothing was saved, show the bar first and try again:
- Chrome, Edge, Firefox, Brave:
Ctrl+Shift+Bon Windows and Linux,Cmd+Shift+Bon Mac. - Safari:
Cmd+Shift+Bshows the Favorites Bar.
Firefox hides the toolbar outside the new tab page by default. Right-click the toolbar area and set Bookmarks Toolbar to Always Show. Full steps for every browser are in How to Add a Bookmarklet.
2. You pasted the code into the address bar
This is the most common mistake. Browsers block javascript: from the address bar to protect people from "paste this code" scams:
- Chrome and Edge silently remove
javascript:from the start of pasted text, so your code becomes a search query. - Firefox ignores
javascript:URLs entered in the address bar by default. - Safari blocks them unless a Develop menu setting is turned on.
Fix: save the code as a bookmark and click the bookmark. Bookmarks are not affected by these protections.
3. The code got mangled when you copied it
If the bookmark's URL does not start with exactly javascript:, it will not run. Edit the bookmark and check for these problems:
- A missing prefix, or an extra one like
http://javascript:. - Curly "smart" quotes (
“ ”) instead of straight quotes, often introduced by word processors, email, or notes apps. - Missing characters at the end, where the copy cut off.
- Line breaks inside the code, which can break statements that relied on them.
Fix: copy the bookmarklet again directly from its page, or drag the button instead of copying text.
4. The URL encoding is wrong
Bookmarklet code is percent-decoded before it runs. If the code contains a bare %, such as width:100% or a modulo operator, the browser may try to decode it as an escape sequence and fail with URIError: URI malformed, or quietly run broken code. Raw # characters can also cause trouble in some situations.
The opposite problem happens too: code that was encoded twice shows up as %2522 instead of %22, and the JavaScript never parses.
Fix: paste the bookmarklet into the Bookmarklet Decoder to see the real code, then rebuild it with the Bookmarklet Maker, which encodes it correctly.
5. The page gets replaced with text
If clicking the bookmarklet wipes the page and shows something like true, [object Object], or a color name, the code returned a value. When a javascript: URL evaluates to anything other than undefined, the browser treats that value as a new page.
Fix: wrap the code in an IIFE, javascript:(()=>{ ... })();, or add void 0 at the end. See How to Create a Bookmarklet for the details.
6. The site's security policy blocks part of the bookmarklet
Some sites send a Content Security Policy (CSP) header. Current versions of Firefox and Chromium-based browsers generally let the bookmarklet's own code run, since you triggered it. The policy can still block what the code tries to do next:
- Loading an external script, such as a library from a CDN.
- Fetching data from another domain.
- Adding a
<style>element when the site restricts styles.
Look for console errors mentioning "Content Security Policy" or "Refused to load." Bookmarklets on this site are built to need none of these, but older bookmarklets that load jQuery or a remote script will break on strict sites. There is no way around the policy from the bookmarklet side. Use a different, self-contained bookmarklet, or an extension.
7. Trusted Types breaks HTML injection
Google Search, YouTube, Gmail, and a growing number of other sites enforce Trusted Types. On those pages, assigning a string to innerHTML, outerHTML, or insertAdjacentHTML throws an error like This document requires 'TrustedHTML' assignment.
Lots of older bookmarklets build their panels with innerHTML, which is why they work everywhere except Google properties. Fix: use a bookmarklet that builds its UI with DOM methods like createElement and textContent. Everything in this directory is tested with Trusted Types enforced. If you wrote the bookmarklet yourself, replace the innerHTML calls.
8. A popup blocker or the clipboard blocks it
Bookmarklets that open a new tab, such as Wayback Machine or PageSpeed checks, use window.open. Browsers allow that only as a direct result of your click. If a bookmarklet waits for a network request first and then opens a tab, the browser may treat it as an unwanted popup.
- Look for the blocked-popup icon in the address bar and allow popups for that site.
- Check that a popup-blocking extension is not interfering.
Clipboard bookmarklets have the same rule. Click inside the page first so it has focus, then click the bookmarklet.
9. You are on a page where bookmarklets cannot run
Some pages are off limits by design:
- Browser-internal pages:
chrome://,edge://, andabout:pages, settings, and the default new tab page. - Extension and add-on stores: the Chrome Web Store and similar store pages block scripts for security reasons.
- Built-in viewers: the browser's PDF viewer and reader view are not normal web pages, so bookmarklets usually cannot touch them.
- Content inside iframes: a bookmarklet runs in the top page. If the content you care about is in an embedded frame from another domain, such as a comment widget or a payment form, the same-origin policy keeps the bookmarklet out. Open the frame's URL in its own tab and run the bookmarklet there.
Bonus: mobile quirks
On phones, bookmarklets need a slightly different routine:
- Android Chrome does not run bookmarklets tapped from the bookmarks list. Type the bookmark's name in the address bar and tap the bookmark suggestion instead of pressing Enter.
- iPhone Safari runs them from the Bookmarks list, but the bookmark must be edited so its address is the code, since dragging is not possible.
- Panels designed for desktop can be cramped on a small screen. Rotate to landscape or zoom out.
Still stuck?
Try the bookmarklet on a simple page like a Wikipedia article. If it works there, the problem is the specific site, most likely numbers 6, 7, or 9 above. If it fails everywhere, the bookmark itself is broken, so reinstall it from its page in the directory. You can also contact us with the bookmarklet name, browser, and the console error, and we will take a look.
Frequently asked questions
Why does Chrome remove javascript: when I paste code into the address bar?
It is a security feature that stops people from being tricked into running malicious code. Save the code as a bookmark and click it instead.
Why does my bookmarklet work on most sites but not on Google or YouTube?
Those sites enforce Trusted Types, which blocks bookmarklets that use innerHTML. Use a bookmarklet built with DOM methods, like all the ones in our directory.
Why does nothing happen on the new tab page?
Browsers do not allow bookmarklets on internal pages such as the new tab page, settings, and extension stores. Open a regular website and try again.
How do I see why a bookmarklet failed?
Open the browser console with F12 (Cmd+Option+J in Chrome on Mac), click the bookmarklet, and read the error. It usually names the cause, such as a CSP, Trusted Types, or syntax error.