Live data from Hacker News

For your next side project, make a browser extension

geoffreylitt.com

141–150 of 286 posts

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

#141
post #81
post #70

Earlier quoted context omitted.

Odd! Were you trying to fetch a public, CORS-enabled API? That should just work. If you were trying to make a network request for a non-CORS endpoint (eg fetch the google homepage or something), you'll need to add the domain to your permissions section. Eg: "permission": [ "storage", " https://google.com " ]

Not OP, I built an extension for a site that sent CSP headers. Because the browser extension wasn't allowed in the list of JS sources, it all borked. Not certain that's this user's issue, but that is another thing to check.

I suspect this is it. There were a lot of things logged to console for twitter violating its own CSP, but I didn’t see any for my script.

It seems the overall handling of network errors in add-ons has a lot of room for improvement.

It should be noted that chromium allows the network request regardless of the CSP. This is the correct, User-Empowering approach. Firefox’s deference to the Origin to control the code the User is attempting to run is the antithesis of what a User Agent ought to be.

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

#142

Earlier quoted context omitted.

Chrome does keep side loaded extensions through restarts. Firefox doesn't unless you submit to Mozilla for signing. But once signed you can install from a file or even your own site.

I use firefox mainly and thought it was common behavior between the two

Mozilla's signing process isn't too bad, especially if your addon changes infrequently. Recommend trying it.

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

#143
post #70
post #65

Earlier quoted context omitted.

Hm. I tried this with an super simple extension[1] I had lying around and couldn't get any network requests to work. The error thrown in console was a generic "NetworkError", but the network tab shows no relevant entries at all. Not a great developer experience, especially compared to chromium. https://github.com/JacksonKearl/FeelingBlue/blob/main/extens...

Odd! Were you trying to fetch a public, CORS-enabled API? That should just work. If you were trying to make a network request for a non-CORS endpoint (eg fetch the google homepage or something), you'll need to add the domain to your permissions section. Eg: "permission": [ "storage", " https://google.com " ]

I have CORS configured to allow the https//twitter.com/ origin. I could see firefox perhaps using a different origin for worker scripts? But hard to tell since the network tab doesn’t show any of the requests.

I could set up server logs locally, but there’s only so many hours in my life.

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

#144

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…

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.

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

#145

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,…

Fx on Android allow add-ons. I've used them for years.

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

#146

I have already made one browser extension for easily adding bookmarks into the category (folder) you want to, or create a new subcategory while adding a bookmark. Try it out! peterhil/spellbook: Spellbook is a bookmark extension for Chrome and Firefox https://github.com/peterhil/spellbook

Do you have a demo?

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

#148
post #109

Earlier quoted context omitted.

The signing requirement only applies to the stable and beta versions of Firefox. It can be disabled in about:config in Firefox Developer Edition (which is basically the same as beta), as well as in Nightly, ESR, and Unbranded builds [1]. [1]: https://wiki.mozilla.org/Add-ons/Extension_Signing

this is not true. with Android version at least, an AMO account is also required.

I was referring to desktop, not Android here. To my knowledge, Android currently requires a custom collection on AMO for installing anything outside the default list.

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

#149

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?

Why don't you consider tampermonkey scripts to be bloat?

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

#150
post #119

Earlier quoted context omitted.

As a user it's not that helpful when extensions which inject stuff into the page (lots of them) all say they can access your history and browsing data. Even though it's actually true, it feels like a gap in the permissions model.

The problem is the gap is a mile wide. If you can see the current page url, you can see the next page URL and thus one page at a time you have the users browsing “history” from the moment they installed the extension, if you can run arbitrary JavaScript then you can check the back URL, you could potentially add some scope related restrictions to what injected JavaScript can do based on the permissions of the injectin…

The only actual solution to this problem is some kind of human review.

I wouldn't be against an "App Store" model provided users could go around it if they chose. I think Mozilla does something like this with certain "featured" extensions?

Post reply on HN