I have a registration system on my website which uses the common activation email trick. This email simply contains instructions and a link to the activation page on my website.
You can name your current window/tab with a JavaScript assignment:
Then you use that name as value for the target
attribute in links, like
...
If mainWindow
does not yet (or no more) exist, it will open in a new tab.
The above stuff does not solve the OP's problem, because for links opened from emails, the target
attribute will usually not be transferred from MUA to browser (except maybe for webmailers, but we cannot rely on this). So I was thinking of some kind of landing page which uses JavaScript to achieve the desired effect:
If this worked, you would only see a second open tab for a moment (case 1), before it closes itself. Yet it is not possible to "close ourselves", as I learned here and here - so in the end there would be a superfluous tab left, which should have been avoided. Seems like it cannot be done, sorry!