brcontainer / prevent-duplicate-tabs

Simple add-on/extension for prevent duplicate tabs
MIT License
62 stars 7 forks source link

Don't open new tab adress if that same tab address was already opened in a specific time frame #7

Closed mspykerez closed 4 years ago

mspykerez commented 4 years ago

Hey! I use google chrome and I wonder if you can make it so that this extension not only prevent the opening of a new tab address that is already currently opened on my browser, but also prevent it from opening if that same tab address was already opened in a specific time frame (lets say a day, a week or month, etc) ? My best guess is that this could be done by checking the tabs to be opened against the browsers history...

brcontainer commented 4 years ago

@mspykerez I've been asked that once before, a few years ago, so I'll answer here officially.

Natively it is impossible, yes, using the proper APIs for webextension is impossible, there is no way to do that, controlling the history at most allows us to do this, controlling the history, generating guides is independent of history, the content is only set later .

Finally, I can say that I could create functions that override "window.open", all anchors (<a>) and forms with target="_blank", but it would not be guaranteed to work, even if I used MutationObserver, because many things are controlled at the time of " Clicks Event ", many website owners add target="_blank" dynamically and there is no way to avoid the race condition "conflict".

Honestly, I thought about doing all of that, but it would generate a lot of complaints and forever be unstable.

if one day exists natively in webextension API I promise to implement.

Thank you very much for your interest, I promise to always give the necessary support, any other suggestions are welcome.