back to posts

“No New Tabs!” A Firefox extension

There are some sites that will just open each link in a new tab. And I hate it.

I hate that they content-optimized themselves to the point where squeezing out another tenth of a percentI imagine. of user retention is worth annoying me with that nonsense.

So I had to take a radical step: I searched for an extension that removes that attribute from all links everywhere. And I didn't find any. But, can you imagine, there are extensions that do the opposite, open every link in a new tab.

So I had to take a radical step: I modified one of these extensions to do what I wanted. Thank you, ahgolden, for writing the best extension template ever.
So here it is, No New Tab!, and here's the source code, with all of its glorious four lines of codeWell, if you count a single } as a separate line.

And that's all.

One more thing

Oh wait, there is one more thing: I tried building this for myself and then just installing it. No need for anyone else to know about my superpowers. But Firefox won't let me install the extension, since it's not signed. Even if I disable the xpinstall.signatures.required setting -- because that one only works in Firefox Developer Edition. I installed FFDEV and tried out the extensionIt works., then submitted for signing. You can choose between “self-distributed” and “hosted”, but I didn't want the hassle so I let them host it for me. Lots of scary language around “we might check and ban your extension at any time!!!” Well, go ahead, review my four-line extension!
Naturally, I made a mistake during the upload and had to upload it again. With a new ID, but ok. It also needs an ID, which I found out from some forum thread where someone had the same problem.

So in a way, you can use my extension as the absolute minimum of what an extension needs.