My views so far on bookmarklets versus addons in Firefox

December 3, 2021

A while back I saw a message in the fediverse advocating for bookmarklets (via):

90% of browser extensions could be bookmarklets, and they’re 100% better for privacy. Bookmarklets should make a comeback.

* Opt in to an action
• No snooping on pages in the background
• Universally supported in browsers

I miss bookmarklets.

I'm a heavy user of Firefox addons, and I've also recently been using bookmarklets in the titlebar for dealing with fixed position page elements and making pages more readable with brute force. The fediverse message got me thinking, and now I think I have some views that are well enough formed to write down.

For me, the simultaneous advantage and drawback of bookmarklets is that they don't activate automatically when you load the page. This makes addons better for things that I want to happen all of the time, automatically. Conversely, bookmarklets are better for things that are sometimes great but also sometimes bad ideas that destroy the page's readability or functionality. Both of my current bookmarklets are of this nature, where I want to apply them to only some web pages (and sometimes only some of the time).

(There are also practical differences, such as addons being able to present a UI and be interactive, but let's hand wave that away. I think most of my addons would currently be flat out impossible as bookmarklets.)

Now that I've thought about this, that my addons are all things that I want to happen all the time is not really a coincidence. Because addons work this way, I've been strongly biased to using only addons that I actually did want all of the time. An 'all the time' addon that you only want some of the time is painful, even if it offers UI controls for this. I probably have blind spots about useful 'some of the time' page modifications that could be bookmarklets.

(One of the obvious ones is a bookmarklet to set visited links to their default colour. This doesn't work everywhere and isn't always the answer I want, but having it as a titlebar button would be quite useful. Sadly, I'm not familiar enough with either JavaScript or manipulating page CSS in JS to write it myself without a bunch of effort.)


Comments on this page:

By seth at 2021-12-04 11:21:40:

For simple CSS changes you don't need javascript. Here's an example bookmarklet for firefox (that's maybe too simple and won't work everywhere?) to restyle in basic black/white with normal links:

javascript:(function(){
  var css=document.createElement('style');
  document.head.appendChild(css);
  css.innerHTML='
    * { background: white !important; color: black !important }
    :link, :link * { color: #0000EE !important }
    :visited, :visited * { color: #551A8B !important }
  ';
})();

You can edit the styles as needed then just merge it all to one line and escape the spaces. e.g. in vim with:

:%s/\(\n\| \)\+/%20/g

If you add certain other chars (like quotes) those need to be replaced too, or run it through a proper escape function.

By mappu at 2021-12-04 17:06:09:

I think there's a bit of a misunderstanding here -

Firefox addons are Safe. They are vetted by AMO and we trust AMO.

Firefox addons that you git clone and install locally are Safe. They're FOSS and you skimmed the source code (right?) and it's not going to change out on you.

Chrome addons are not safe. I was using a popular extension in Chromium to change CSS on all websites; the ownership of this extension silently changed hands to a new corporation that added tracking code, and my browsing history was leaked without my consent. The addon needed to be able to modify all websites - imagine the damage it could have caused. My heart stopped for a second when i thought about it.

Bookmarklets are a defense against this. Certainly they are less convenient in general but i think it is stopping a different problem than you are imagining.

By cks at 2021-12-04 18:15:40:

Sadly, Firefox addons aren't safe either, at least in practice. The Stylish addon for Firefox was compromised in the same way as the version for Chrome (and replaced by Stylus). It's possible that Firefox addons are somewhat safer in practice if you stick to the subset that is in the Recommended category, but not all interesting ones that I care about are.

(Certainly I can't imagine Chrome recommending a full bore ad and content blocker the way Mozilla/Firefox puts the Recommended badge on eg uBlock Origin.)

Written on 03 December 2021.
« On servers maybe moving to M.2 NVMe drives for their system drives
Most computer standards broadly require good faith implementations »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Fri Dec 3 22:54:06 2021
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.