back

by Alifatisk·3y ago·view on hn ↗
I try to stay away from browser extensions as much as I can, it will only bloat my browser even further. Firefox + Tampermonkey should be enough in my case.

Is there anything a browser extension can do that Tampermonkey cannot?

5 comments
Tampermonkey can change what's on the web page, but extensions can do much more than that, e.g. add toolbar menus and items to the context menu, add keyboard shortcuts, manage bookmarks, and so on. (See the API guide for an overview [1])

It's true that many extensions could "just be" Tampermonkey scripts. I'd guess they ship as standalone extensions due to a combination of: less friction to install, more discoverable, can extend with fancier features later on, and probably just inertia/ignorance from developers unaware of Tampermonkey.

1. https://developer.chrome.com/docs/extensions/reference/

As for keyboard shortcuts, userscripts can do that by observing individual key presses. I personally use a tiny library [0] by the Violentmonkey team to do it which is easy to use and smooths out differences between platforms and browser implementations.

While userscripts can't add items to toolbar or context menus, you can register menu commands [1] which have the added benefit of being able to be added dynamically after examining page contents. This is done using the `GM_registerMenuCommand` api [2].

[0]: https://violentmonkey.github.io/guide/keyboard-shortcuts

[1]: https://imgur.com/a/SWpOoRS

[2]: https://violentmonkey.github.io/api/gm/#gm_registermenucomma...

Right, for the average user the barrier to entry for userscripts is significantly higher than for extensions. I recently released one (a small enhancement to the Netflix UI) in both forms for this reason: https://greasyfork.org/en/scripts/446689-netflix-recommendat..., https://chrome.google.com/webstore/detail/netflix-recommenda...
A friend of mine uses this extension that tracks emails. It injects a pixel it made remotely into the email body. That sketches me out so much ha.

But yeah I have made a few extensions myself since I spend a lot of time in Chrome. If they go ahead with the anti-adblock I will have to learn Firefox's extension.

> Is there anything a browser extension can do that Tampermonkey cannot?

Tampermoney is an extension, so it can obviously do the same as others. But how much of this does it make accessible to the user scripts? Can you access the local file system? Other Servers? Can you modify the browser-interface itself? Context menu, toolbars, sidebar, add shortcuts, etc.? Can you save persistent data? And can you do all this at an elaborated level of quality?

blocking ads amongst many other browser native features. managing history/tabs/bookmarks/adding right click options/interacting with native applications on your computer for a few
Why don't you consider tampermonkey scripts to be bloat?
Well, I do. I try to have as few scripts as possible.
>Is there anything a browser extension can do that Tampermonkey cannot?

Blocking ads, translating web pages, bypassing paywalls, adding features to websites (like the YouTube extension), clearing trackers, I could go on and on.