Chrome extension: Open in this tab

June 16th, 2024. Tagged: chrome, JavaScript

Do you hate it when sites open new tabs, for example from search results? Yeah, me too. So I thought a good idea would be to have a right-click "Open in this tab" similar to "Open in a new tab" option. Voilà, a new Chrome extension.

You can install it from the store.

How it works?

Two options:
1. Right-click a link and use the context menu
2. Hold the "t" key (as in "Tab") and click the link

Development

I took https://extension.js.org/ for a spin. It's nice when auto-refresh works. But it doesn't always. Overall a good experience, saves some time and it's not overly abstracted to a point of confusion.

Code

... is on github: https://github.com/stoyan/openinthesametab.
All the "business" is in service_worker.js for the context menu and content.js for the hold-t-and-click feature.

Cross-browser?

I took one small step in x-browserness but that's about it:

if (typeof browser !== 'object') {
  browser = chrome;
}

Feedback?

My wife thinks it's the most useless thing ever because she likes to open the search results in new tabs so she can switch. But she also has over 500 open tabs at any time (no exaggeration) and wouldn't install an extension so not my target audience anyway 🙂 What do you think?

Tell your friends about this post on Facebook and Twitter

Sorry, comments disabled and hidden due to excessive spam.

Meanwhile, hit me up on twitter @stoyanstefanov