Live data from Hacker News

For your next side project, make a browser extension

geoffreylitt.com

251–260 of 286 posts

Re: For your next side project, make a browser extension

#251

Are browser extensions safe? My understanding is they generally get access to everything you browse, and are too big a security risk for a work machine. Is it as bad as I think?

They are approximately as big of a risk as any other third-party code you install from the Web onto your machine (e.g. tools from dev SDKs).

Re: For your next side project, make a browser extension

#252
post #53

I very briefly looked into extensions for some things I wanted to do, but got kind of lost in the documentation. The browsers seem to expose a very large API and I failed to figure out if it supports what I wanted. Essentially what I wanted was to be able to implement a simplified version of the "wget" command. I wanted to be able to invoke the extension on a page and have it save the current page contents to a file,…

You don't need an extension to do that. You can get by with a bookmarklet, which would be wise, considering how much contempt browser makers have for extension authors.

Re: For your next side project, make a browser extension

#253

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?

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…

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...

Re: For your next side project, make a browser extension

#254
post #243

Earlier quoted context omitted.

Correct.

whats the point of using nextjs if youre not using ssr? wont CRA work fine?

Maybe they're wanting the image/font/script optimizations Next.js includes, or the other tooling it abstracts (e.g. SWC). You can use Next.js in full-SPA mode (e.g. next export) if you want. I would recommend that or Vite+React over CRA.

Re: For your next side project, make a browser extension

#256

I was enthusiastic enough about extensions that I decided to publish a book about building them: https://www.buildingbrowserextensions.com/ Browser extensions are severely underrated as a platform because they aren't sexy. For all that mobile devices have given us, so much of our work continues to be done using a desktop browser. Enhancements such as augmenting websites with widgets, supplying contextual information,…

I’d say their fatal flaw is you don’t control the platform. I’d not invest my time on them for that reason alone. Like writing Excel macros.

Re: For your next side project, make a browser extension

#257
post #53

I very briefly looked into extensions for some things I wanted to do, but got kind of lost in the documentation. The browsers seem to expose a very large API and I failed to figure out if it supports what I wanted. Essentially what I wanted was to be able to implement a simplified version of the "wget" command. I wanted to be able to invoke the extension on a page and have it save the current page contents to a file,…

You don't need an extension to do that. You can get by with a bookmarklet, which would be wise, considering how much contempt browser makers have for extension authors.

Wait...a bookmarklet can do stuff on multiple pages?

I thought that if I had a bookmarklet and invoked it on a page, and the bookmarklet navigated to a different page the running instance of that bookmarklet would go away.

Re: For your next side project, make a browser extension

#258
post #240
post #160

Earlier quoted context omitted.

> defeat Elsevier & other vultures of scientific publication That’s a great way to have your life savings drained, or worse. Don’t do it if you live anywhere where you can be nabbed by Uncle Sam. See Aaron Swartz, Alexandra Elbakyan.

well, millions of people live somewhere that fit that description. surely someone’s done it? i dont have any personal use for it but i find it hard to believe “where you live” is any material barrier to free scientific information

You are missing the point. "Where you live" IS a material barrier to your getting sued, or arrested.

Re: For your next side project, make a browser extension

#259
post #110
post #104

I spent some time some productivity extensions, for gmail replies[0] and quick notetaking[1]. It was a lot of fun, but like other people have mentioned, porting to and working with manifest v3 is not as nice. I've noticed also that the way Google asks for permissions from the user is done in human-understandable, but worst-case language. For example, I think there was something where I wanted access to the current ta…

They're describing the worst-case thing someone could do with the privilege being granted, because they have no way of saying what the developer will do with the privilege. The way to make the prompt sound less scary, is to use finer-grained permissions where the worst-case thing someone could do is less scary. (Or, if there aren't any fine-grained permissions suited to doing your task — then propose some! The browse…

Alternatively, phrase the permission as what the app is technically trying to do, with a warning about what this could be used for.

"This extension wants be able to inject content in any tab. (Warning: This could potentially be used to track history of sites, and access all browsing data)."

That is actually accurate, while the current message is misleading.

Imagine this sort of scheme extended to "root" permission in ChromeOS. The stating worse case vs accurate with warning about worse case would be as follows:

> [Appname] wants permission to steel all your data and brick your device.

and

> [Appname] wants full control of this device. (Warning: this level of access could be used to steal your data, or brick your device).

The first one is most likely untrue, and borders on libel, while the second is true and accurate.

Re: For your next side project, make a browser extension

#260
post #23

Any suggestions for a good stack to develop extensions? I'm coming from nodejs/react, and would like to stay close to that. Is there an up-to-date stack I can clone, copy, and deploy with something like 'yarn run build' and start hacking?

Shameless plug, but we built the Plasmo Framework to make that (and a lot more) super easy: https://github.com/plasmohq/plasmo

Suggestion: please indicate your supported target platforms (browsers) in the readme.
Post reply on HN